Skip to main content
Priti Gohil (PwC) が「#Apex」で質問

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 ?

 
1 件の回答
  1. 2019年8月6日 12:59
    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.​