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 

NameTypeDescription
primaryTabIdstringID of the primary tab from which the subtab IDs are returned.
callbackfunctionJavaScript 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/68.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:

NameTypeDescription
idsstringAn array of open subtab IDs.
successbooleantrue if firing the event was successful; false if firing the event wasn’t successful.