Newer Version Available

This content describes an older version of this product. View Latest

Methods for Console Events

JavaScript can be executed when certain types of events occur in the console, such as when a user closes a tab. The following standard events are supported in API version 30.0 or later:
Event Description Payload
sforce.console.ConsoleEvent.OPEN_TAB Fired when a primary tab or subtab is opened.
  • id — The ID of the opened tab.
  • objectId — The object ID of the opened tab, if available.
sforce.console.ConsoleEvent.CLOSE_TAB Fired when a primary tab or subtab with a specified ID in the additionalParams argument is closed. Or, fired when a primary tab or subtab with no specified ID is closed.
  • id — The ID of the closed tab.
  • objectID — The object ID of the closed tab, if available.
You can use the following methods for console events:
Method Description
addEventListener() Adds a listener for a custom event type or a standard event type when the event is fired. This method adds a listener for custom event types in API version 25.0 or later; it adds a listener for standard event types in API version 30.0 or later.
fireEvent() Fires a custom event. This method is only available in API version 25.0 or later.
removeEventListener() Removes a listener for a custom event type or a standard event type. This method removes a listener for custom event types in API version 25.0 or later; it removes a listener for standard event types in API version 30.0 or later.