+ Start a Discussion
Paul Mackintosh 3Paul Mackintosh 3 

Does sforce.console.onFocusedPrimaryTab work? Does it work inside a publisher action?

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

- `onFocusedPrimaryTab`
http://www.salesforce.com/us/developer/docs/api_console/Content/sforce_api_console_onfocusedprimarytab.htm
- `onFocusedSubtab` http://www.salesforce.com/us/developer/docs/api_console/Content/sforce_api_console_onfocusedsubtab.htm

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.

Does anyone have any experience of `onFocusedPrimaryTab` working?

  [1]: http://www.salesforce.com/us/developer/docs/api_console/index.htm
Best Answer chosen by Paul Mackintosh 3
ShashForceShashForce
Hi Paul,

This is what I could find on this topic.

onFocusedPrimaryTab() is only supported by app-level custom components, which can be configured by doing:

1. Create component: Setup | Customize | Service Cloud Console
2. Add component: Setup | Create | Apps | <your console app> | Edit | Choose Custom Console Components

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank

All Answers

ShashForceShashForce
Hi Paul,

This is what I could find on this topic.

onFocusedPrimaryTab() is only supported by app-level custom components, which can be configured by doing:

1. Create component: Setup | Customize | Service Cloud Console
2. Add component: Setup | Create | Apps | <your console app> | Edit | Choose Custom Console Components

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank
This was selected as the best answer
Paul Mackintosh 4Paul Mackintosh 4
Great, following your suggested steps worked.  

I had tried to add a Custom Console Component by editing the layout for various objects but I had missed how to specify a Custom Console Component at the App level via "Choose Custom Console Components".

It's disappointing that 'onFocusedPrimaryTab' won't work within the context of a Publisher Action at this time, but you've helped me to understand how this function should be used.