We had used the onFocusSubtab function in an VF page with standard controller( overwritten for a standard object view action).
When we use the onFocusSubtab for doing some business logic it woks only with latest tab opened in the service console.
Issue: when a tab is closed and open other record from the same object, onFocusSubtab stopped working. Not only it stopped working, it also breaks service console.
Ex..
When we use the onFocusSubtab for doing some business logic it woks only with latest tab opened in the service console.
Issue: when a tab is closed and open other record from the same object, onFocusSubtab stopped working. Not only it stopped working, it also breaks service console.
Ex..
- Other tabs will start behaving abnormally, like content of other tabs will display for some other tab.
- In one case, it splits screen in half and disturbs whole service console and tabs.
Resolution: We have to use alternative approach to deal with the onFocusSubtab
Solution: In the same place use an addEventListener for CloseTab event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add a listener to handle the closing of the enclosing primary tab | |
sforce.console.getEnclosingPrimaryTabId(function (result) { | |
var onEnclosingPrimaryTabClose = function (CallbackRes) { | |
alert('The enclosing primary tab is about to be closed. Tab ID: ' + CallbackRes.id + ', Object ID: ' + (CallbackRes.objectId ? CallbackRes.objectId : 'not available')); | |
}; | |
if (result.id) { | |
sforce.console.addEventListener(sforce.console.ConsoleEvent.CLOSE_TAB, onEnclosingPrimaryTabClose, { tabId : result.id }); | |
} else { | |
alert('Could not find an enclosing primary TAB!'); | |
} | |
}); |
Comments
Post a Comment