Newer Version Available
getTabLink()
Retrieves the URL to a tab, or group of related tabs, from
the Salesforce console. This method is only available in API version 28.0 or
later.
Syntax
1sforce.console.getTabLink(level:String, (optional)tabId:String, (optional)callback:Function)Arguments
| Name | Type | Description |
|---|---|---|
| level | string | Level that matches one of the Link to Share options in the Salesforce console user
interface. The options are:
For more information, see “Salesforce Console Tabs” in the online help. |
| tabId | string | Optional tab ID of the tab from which you’re retrieving the URL. If you do not pass a tab ID, the URL to the current tab is returned. |
| 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 <apex:includeScript value="/support/console/28.0/integration.js"/>
19 <A HREF="#" onClick="getEnclosingPrimaryTabId();return false">
20 Click here to get tab link</A>
21
22 <script type="text/javascript">
23 var getEnclosingPrimaryTabId = function getEnclosingPrimaryTabId() {
24 sforce.console.getEnclosingPrimaryTabId(getTabLink);
25 }
26 var getTabLink = function getTabLink(result) {
27 sforce.console.getTabLink(sforce.console.TabLink.PARENT_AND_CHILDREN, result.id, showTabLink);
28 }
29 var showTabLink = function showTabLink(result) {
30 var link = result.tabLink;
31 };
32 </script>
33</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 |
|---|---|---|
| tabLink | string | The retrieved URL. |
| success | boolean | true if the link was retrieved successfully, false if retrieving was unsuccessful. |
| callback | function | JavaScript method that’s called upon completion of the method. |