Newer Version Available
getPrimaryTabIds()
Returns all of the IDs of open primary tabs. This method is only available in
API version 26.0 or
later.
Syntax
1sforce.console.getPrimaryTabIds((optional) callback:Function)Arguments
| Name | Type | Description |
|---|---|---|
| callback | function | JavaScript method that’s called upon completion of the method. |
Sample Code–Visualforce
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page>
18 <A HREF="#" onClick="testGetPrimaryTabIds();return false">
19 Click here to get the primary tab IDs</A>
20
21 <apex:includeScript value="/support/console/26.0/integration.js"/>
22 <script type="text/javascript">
23 function testGetPrimaryTabIds() {
24 sforce.console.getPrimaryTabIds(showTabId);
25 }
26
27 var showTabId = function showTabId(result) {
28 //Display the primary tab IDs
29 alert('Primary Tab IDs: ' + result.ids);
30 };
31 </script>
32</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 primary tab IDs , in order of appearance. |
| success | boolean | true if returning the IDs of open primary tabs was successful; false if returning the IDs of open primary tabs wasn't successful. |