The Salesforce Console Integration Tookit provides two functions for detecting switching focus of console tabs:

I've been working on a Custom Visualforce Global Action and I'm able to use onFocusedSubtab without any issue to detect focus. However onFocusedPrimaryTab does not work in the same way. I have tested both functions using the samples from the documentation and I have no errors in Chrome dev tools that would indicate the callback is not being registered with onFocusedPrimaryTab.

The documentation does not indicate that they should behave differently, the only subtle hint that they may be different is that onFocusedSubtab is in the "Methods for Primary Tabs and Subtabs" section of the docs whilst onFocusedPrimaryTab is in the "Methods for Application-Level Custom Console Components" section. For this reason I tried hooking up a callback in the console from a Custom Console Component in the highlights panel (top of Service Console), but it still didn't work.

Sample code from the documentation:

    <apex:includeScript value="/support/console/25.0/integration.js"/>

    <script type="text/javascript">
        var eventHandler = function (result) {
            alert('Focus changed to a different primary tab. The primary tab ID is:' 
        + result.id + 'and the object Id is:' + result.objectId);

Does anyone have any experience of onFocusedPrimaryTab working?

1 Answer 1


The onFocusedPrimaryTab function is available as one of the "Methods for Application-Level Custom Console Components".

I had tried to add a Visualforce page to the console via the Custom Console Component link for layouts e.g:

Custom Console Component on layouts

I actually needed to add a Custom Console Component via the App | Edit screen

Adding Application Level Custom Console Components

The answer to my question is that yes onFocusedPrimaryTab does work from the context of a Custom Console Component but it doesn't appear to work from within a Publisher Action (Quick Action).

You must log in to answer this question.

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