In Service console, if the Primary tab is already open, we need to focus the primary tab. How to check whether the primary tab is already opened in console or not?

1 Answer 1


I'd suggest using a combination of getPrimaryTabIds and getPageInfo methods from the toolkit in order to determine if a tab is open, based on whatever criteria you want. A sample of what this code might look like for finding a tab with a given object ID is below

<script src="/support/console/37.0/integration.js" type="text/javascript"></script>

function findTab(criteria) {  


    function getPageInfo(result) { 
        if(result.ids.length==0) {
            alert('No Tabs Open'); 
        for(i=0; i<result.ids.length; i++) { 
            sforce.console.getPageInfo(result.ids[i], checkPresence);

    function checkPresence(result) { 
        if(JSON.parse(result.pageInfo).objectId==criteria) {
            alert('Tab Found');


<a href="#" onclick="findTab('001xx0000012345');">Find Tab</a>



You must log in to answer this question.

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