function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KrForceKrForce 

addEventListener: Unsupported Operation: This API cannnot be used on this component

Hi,
my goal is to keep only one contact TAB opened in Console all the time , if there is already a tab opened i need to close it and open the new tab.

I have a VF section on standard detail page and i added addEventListener for OPEN_TAB. When the EventListener function executes on TAB open getting the error saying un supported API function. does it means i can't add EventListener on a VF section? if so is there in other work around for this?

function getAllTabIds() {
// get all Tab ID's
sforce.console.getEnclosingPrimaryTabIds(closeAlltabs);
}
var closeAlltabs = function closeAlltabs(results) {
alert('closeAlltabs Called'+result.ids);
var tabId = result.id;
};
sforce.console.addEventListener(sforce.console.ConsoleEvent.OPEN_TAB, getAllTabIds, { tabId : sforce.console.getEnclosingTabId() });
Anoop AsokAnoop Asok
Bit late, but hopefully this might be useful in the future.

The sforce.console object in embedded VF pages on standard layouts doesn't support adding listeners if you're using Integration Toolkit v 30 or above. Since you want to listen for the standard OPEN_TAB event, I guess lowering the version is not an option.

The workaround I can think of is to implement the listener code on a Custom Console Component which is linked linked to a VF page.