You need to sign in to do that
Don't have an account?
OzZiE90
Custom, dynamic highlight panel
Hi all,
I am attempting to create a custom highlight panel. What I ultimately need to do is on the focus of a subtab, I need an event to fire and send information to the highlight panel. The highlight panel is for the primary tab (Account), and the event needs to fire from the subtab (Opportunity). The reason I need to do it like this is because we pull in information via an outside API (which is displayed on the subtab on a VF page), and when a subtab is focused, I need the fired event to send this information so the primary tab highlight panel can grab it.
I am aware of the sforce.console.onFocusedSubtab() method, however, the issue with this is that the event will fire for every subtab that is open. So if 3 opporutnity subtabs are open for one account, when one of those subtabs is focused, all 3 events will be fired from all 3 subtabs.
Does anyone have any suggestions how I can go about getting the event to fire only from the focused subtab?
Thanks in advance, and any suggestions/comments would be much appreciated.
I am attempting to create a custom highlight panel. What I ultimately need to do is on the focus of a subtab, I need an event to fire and send information to the highlight panel. The highlight panel is for the primary tab (Account), and the event needs to fire from the subtab (Opportunity). The reason I need to do it like this is because we pull in information via an outside API (which is displayed on the subtab on a VF page), and when a subtab is focused, I need the fired event to send this information so the primary tab highlight panel can grab it.
I am aware of the sforce.console.onFocusedSubtab() method, however, the issue with this is that the event will fire for every subtab that is open. So if 3 opporutnity subtabs are open for one account, when one of those subtabs is focused, all 3 events will be fired from all 3 subtabs.
Does anyone have any suggestions how I can go about getting the event to fire only from the focused subtab?
Thanks in advance, and any suggestions/comments would be much appreciated.
Perhaps you could make use of the getFocusedSubtabId() method in conjunction with the onFocusedSubtab() callback to ensure the event is fired only from the focused subtab.
That is a great idea, unfortuneately I already attempted to do some logic to only fire the event using the
getFocusedSubtabId() in conjunction with onFocusedSubtab() (I probably should have mentioned that). The thing about that is when onFocusedSubtab() is called, it gets called from every tab. So when getFocusedSubtabId() gets called after, the result from onFocusedSubtab() will already contain the ID from the currently focused tab. So when getFocusedSubtabId(), it will contain the same ID.
Quoted from SF:
It sounds like the onFocusedSubtab() method is not behaving as documented unless I'm missing something-how could multiple tabs simultaneously have focus? Perhaps you can try to use a global javascript variable as a flag to prevent the duplicate firing, though I suppose if the actions are firing in parallel this might not help.
Quote from SF for method:
Are you able to share any more of the code for your console? I wonder if there is something else we're missing that is causing the conflict because I don't believe the onFocusedSubtab callback function should fire for all open sub tabs when focus changes, but rather only once with a response for the newly focused sub tab.
window.onload = function(){
var fireEvent = function(result){
sforce.console.fireEvent( 'oppLoad', oppID);
Sorry for the delayed response-out of curiosity do you see this behavior in all browsers? Sometimes javascript issues can be browser-related so it might be a good idea to test out all the usual suspects (Chrome, Firefox, & IE) to see if the problem is really a result of some browser incompatibility. You may very well end up having to open a case with Salesforce, but in the meantime you could try using a setTimeout to possibly help your cause like below:
This is intended to ensure the sforce.console.fireEvent method is fired only once, though you may need to adjust the delay-hope this helps!
Sorry for the delayed reponse as well... It was not a browser issue (PS I did try the timeout previously and it did not work, great suggestion though). I actually ended up opening a case with Salesforce and they confirmed what I had originally thought (the event will fire from every tab no matter what tab gets focused).
Currently, there is no work around to force Salesforce to only fire from the actual focused tab. I eneded up having to change a few things in my UI to get what I wanted.
Thank you for your responses!
Happy to help, but sorry it wasn't more useful. Bummer that you had to rework your approach but I guess sometimes that is the lowest-hanging fruit, certainly in this case given the response from the support team. Happy coding!