The following function will help you to open a sub tab. Service console kit offers lot of methods with callback feature & using them we can achieve the UI requirements.
Here in this scenario goal is to open a sub tab considering the window is opened console or not and making it dynamic so that any page can access this resource file in the static resource.
More information can be seen @ https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_opensubtab.htm
Here in this scenario goal is to open a sub tab considering the window is opened console or not and making it dynamic so that any page can access this resource file in the static resource.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**Params | |
* 1. url ----- string URL | |
* 2. tabName - String tab name | |
**/ | |
function openLink(url, tabName) { | |
var openSubtab = function openSubtab(result) { | |
//Now that we have the primary tab ID, we can open a new subtab in it | |
var primaryTabId = result.id; | |
sforce.console.openSubtab(primaryTabId, '/' + url, true, tabName, null, tabName); | |
}; | |
if (sforce.console.isInConsole()) { | |
//First find the ID of the primary tab to put the new subtab in | |
sforce.console.getEnclosingPrimaryTabId(openSubtab); | |
} else { | |
(window.open('/' + url, '_blank')).focus(); | |
} | |
} |
Comments
Post a Comment