Newer Version Available
generateConsoleUrl()
Generates a URL to a tab, or group of related tabs,
in the Salesforce console. If any tabs
include external URLs, then add the external URLs to the console’s whitelist so
that they can display correctly. For more information, see “Whitelist Domains for a Salesforce Console” in the online help. This method is only available in API version 28.0 or
later.
Syntax
1sforce.console.generateConsoleUrl(urls:String, (optional)callback:Function)Arguments
| Name | Type | Description |
|---|---|---|
| urls | string | An array of URLs. The first URL is a primary tab and subsequent URLs are subtabs. Note that the last URL is the subtab on which the console is focused. These URLs can be standard Salesforce URLs or relative URLs. |
| callback | function | JavaScript method that’s called upon completion of the method. |
Sample Code–Visualforce
1<apex:page>
2 <apex:includeScript value="/support/console/28.0/integration.js"/>
3 <A HREF="#" onClick="testGenerateConsoleURL();return false">
4 Click here to generate a console URL</A>
5
6 <script type="text/javascript">
7 function showConsoleUrl(result) {
8 alert(result.consoleUrl);
9 }
10 function testGenerateConsoleURL() {
11 sforce.console.generateConsoleUrl([/apex/pagename, /entityId, www.externalUrl.com, Standard Salesforce Url/entityId], showConsoleUrl); }
12 </script>
13</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 |
|---|---|---|
| consoleUrl | string | Console URL that represents the array of URLs passed into Salesforce. |
| success | boolean | true if the URL was generated successfully, false if otherwise. |
| callback | function | JavaScript method that’s called upon completion of the method. |