Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Methods for Console Events

JavaScript can be executed when certain types of events occur in a console, such as when a user closes a tab. The following standard events are supported:
Event Description Payload
sforce.console.ConsoleEvent.OPEN_TAB Fired when a primary tab or subtab is opened. Available in API version 30.0 or later.
  • 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. Available in API version 30.0 or later.
  • id — The ID of the closed tab.
  • objectID — The object ID of the closed tab, if available.

    Note: For some objects (such as Email and Case Comment), the tab is opened and closed immediately and no object ID is generated for the tab. In those cases, this field’s value is equal to the parent’s object ID.

  • tabObjectId — The object ID of the closed tab, if available.

    Note: tabObjectId is generally the same as objectID. However, for tabs that close upon submission, no tabObjectId is generated. In those cases, the value of this field is either empty or null. For an Email, the value is empty. For a Case Comment, the value is null.

sforce.console.ConsoleEvent.CONSOLE_LOGOUT Delays the execution of logging out of a console when a user clicks Logout. When Logout is clicked:
  1. An overlay appears, which tells a user that logout is in progress.
  2. Callbacks are executed that have been registered by using sforce.console.ConsoleEvent.CONSOLE_LOGOUT.
  3. Console logout logic is executed.

If the callback contains synchronous blocking code, the console logout code isn’t executed until the blocking code is executed. As a best practice, avoid synchronous blocking code or long code execution during logout.

Available in API version 31.0 or later.

None