Showing posts with label console. Show all posts
Showing posts with label console. Show all posts

Wednesday, July 10, 2019

How To Check Whether User is In Console or Not in Lightning Experience

Basically if you want to check whether user in Lightning experience console(sales/service consoles in lightning experience not the just lightning experience ) you can use the same sforce console methods which you have used in classic.This method will support in lightning experience with out any changes.

Sample code:

<apex:page> 
<apex:includeScript value="/support/console/42.0/integration.js" /> 
<apex:includeScript value="/support/api/41.0/interaction.js"/> 

<button onclick="openTab();" > Console openPrimaryTab</button> 

<script> 
function inConsole() { 
if (sforce.console.isInConsole()) { 
alert('In console'); 
}else { 
alert('Not in console'); 
} 
}
</apex:page>

Note:
Even after using this if it's not working please check you version of /support/api/42.0/integration.js. If your version is below 42 then it will not work.So,please change the version it will work automatically.

Hope this helped you..Enjoy!..