Newer Version Available

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

getSubtabIds()

Returns all of the IDs of the subtabs on the primary tab specified by a primary tab ID. If the primary tab ID is null, it returns the IDs of the subtabs on the current primary tab. This method can only be called from a custom console component or a detail page overwritten by a Visualforce page. This method is only available in API version 26.0 or later.

Syntax

1sforce.console.getSubtabIds( (optional) primaryTabId:String, (optional) callback:Function)

Arguments

Name Type Description
primaryTabId string ID of the primary tab from which the subtab IDs are returned.
callback function JavaScript method that’s called upon completion of the method.

Sample Code–Visualforce

1<apex:page>
2    <A HREF="#" onClick="testGetSubtabIds();return false">
3        Click here to get the subtab IDs</A> 
4
5    <apex:includeScript value="/support/console/61.0/integration.js"/>
6    <script type="text/javascript">
7        function testGetSubtabIds() {
8            //Get the subtabs of the primary tab 'scc-pt-0'
9           //This value is for example purposes only
10             var primaryTabId = 'scc-pt-0';
11              sforce.console.getSubtabIds(primaryTabId , showTabId);
12        }
13        
14        var showTabId = function showTabId(result) {
15            //Display the subtab IDs
16            alert('Subtab IDs: ' + result.ids);
17            };
18  </script>
19</apex:page>

Response

This method is asynchronous so it returns its response in an object in a callback method. The response object contains the following fields:

Name Type Description
ids string An array of open subtab IDs.
success boolean true if firing the event was successful; false if firing the event wasn't successful.