I am working on implementing OpenCTI in Salesforce Lightning, but problem getting the correct User Experience Context. When opening VF as softPhone in LEX it's returning $User.UITheme = "Theme3" although same page opened from tab returns "Theme4d".

Is there any way we can use same VF in classic and LEX or we have to create two separate call center and VF pages.

Below are my sample Call center definition and VF file along with SoftPhone result,

<section sortOrder="0" name="reqGeneralInfo" label="General Information">
    <item sortOrder="0" name="reqInternalName" label="InternalName">OpenCTI</item>
    <item sortOrder="1" name="reqDisplayName" label="Display Name">OpenCTI</item>
    <item sortOrder="2" name="reqAdapterUrl" label="CTI Adapter URL">/apex/CTI_light</item>
    <item sortOrder="3" name="reqUseApi" label="Use CTI API">true</item>
    <item sortOrder="4" name="reqSoftphoneHeight" label="Softphone Height">530</item>
    <item sortOrder="5" name="reqSoftphoneWidth" label="Softphone Width">205</item>
    <item sortOrder="6" name="reqSalesforceCompatibilityMode" label="Salesforce Compatibility Mode">Classic_and_Lightning</item>
<section sortOrder="1" name="reqDialingOptions" label="Dialing Options">
    <item sortOrder="0" name="reqOutsidePrefix" label="Outside Prefix">9</item>
    <item sortOrder="1" name="reqLongDistPrefix" label="Long Distance Prefix">1</item>
    <item sortOrder="2" name="reqInternationalPrefix" label="International Prefix">01</item>

<!-- panel to be displayed only in classic mode -->
<apex:outputPanel rendered="{! $User.UITheme == 'Theme3' }">
    <apex:outputText value="This is Salesforce Classic."/>
    <apex:includeScript value="/support/api/38.0/interaction.js"/>       

<!-- panel to be displayed only in Lightning -->
<apex:outputPanel rendered="{! $User.UITheme == 'Theme4d' }">
    <apex:outputText value="This is Lightning Experience."/>
    <apex:includeScript value="/support/api/38.0/lightning/opencti_min.js"/>

enter image description here

1 Answer 1


This is a known bug. The UITheme will always return 'Theme3' when the page is opened in CTI context. Until the bug is fixed you would need separate pages and call centers to get difference Classic and Lightning rendering.

You can find the Known Issue report below, and click 'This Issue Affects Me' to be notified when it is fixed and released for you.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .