function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kristiana GrangerKristiana Granger 

One scenario - How can we come to know action getting clicked from LE/Classic/Salesforce1

Ex - There is one button(action) we have created.

when user clicked that button from LE so it should open view in Lightning ,
when user clicked from classic it should open in classic view
when user clicked from salesforce1 it should be open in respective view.
based on which things we can come to know. can any one gives me sample code ?


 

Best Answer chosen by Kristiana Granger
Bhargavi TunuguntlaBhargavi Tunuguntla
Hi Priti,

Create a VF page button this will show you the lightining view/classic view/mobile view based on button clicked platform.
To specifically redirect to a separate VF Page you can use the below code to differentiate between salesforce1 and classic/lightning:
<apex:page standardController="SBQQ__Quote__c" extensions="ExampleClass" action="{!redirectToVf}">
<apex:outputPanel id="sf1ReloadPanel" rendered="{!$User.UIThemeDisplayed == 'Theme4t'}">
 <C:CallLightningCOmponent/> <!-- any other action for mobile>
</apex:outputPanel>
</apex:page>
'Theme4t' indicates mobile view and we can even check this is in apex class:
if(UserInfo.getUiTheme() != 'Theme4t')
        {
            PageReference r=new PageReference('/apex/notMobilePage?id='+ApexPages.currentPage().getParameters().get('id'));
            return r;
            
            
        }
        return null;
Let me know if this was helpful.
Thanks.​