You need to sign in to do that
Don't have an account?
Alibaba
Opening VF page in a service console subtab using Javascript Detail Page Button
Hello,
I'd like to open a VF page in a subtab from a detail-page button.
If I use a URL with 'Display in an Existing Window', the VF page will open in the existing tab. If I use 'Display in New Window', the URL will show up in a new browser window. I'm trying to use the Console Integration Toolkit, instead of srcup() or some other unsupported workaround.
I created a javascript button, and tried the following code, but nothing happens. Literally nothing, no error, no page opening. What am I doing wrong? Help would be greatly appreciated.
{!REQUIRESCRIPT("/soap/ajax/36.0/connection.js")}
{!REQUIRESCRIPT("/support/console/36.0/integration.js")}
sforce.console.getEnclosingPrimaryTabId(callOpenSubtab);
var callOpenSubtab=function callOpenSubtab(result) {
sforce.console.openSubtab(result.id,
'/apex/vfpage', true, 'New Case');
}
I'd like to open a VF page in a subtab from a detail-page button.
If I use a URL with 'Display in an Existing Window', the VF page will open in the existing tab. If I use 'Display in New Window', the URL will show up in a new browser window. I'm trying to use the Console Integration Toolkit, instead of srcup() or some other unsupported workaround.
I created a javascript button, and tried the following code, but nothing happens. Literally nothing, no error, no page opening. What am I doing wrong? Help would be greatly appreciated.
{!REQUIRESCRIPT("/soap/ajax/36.0/connection.js")}
{!REQUIRESCRIPT("/support/console/36.0/integration.js")}
sforce.console.getEnclosingPrimaryTabId(callOpenSubtab);
var callOpenSubtab=function callOpenSubtab(result) {
sforce.console.openSubtab(result.id,
'/apex/vfpage', true, 'New Case');
}
Please try the below code. Change it accoding to your requiremnet.
if("{!$CurrentPage.parameters.returnURL}" == '1')
sforce.console.getEnclosingPrimaryTabId(openPrimarytab);
else
sforce.console.getEnclosingPrimaryTabId(openSubTabId);
function openSubTabId(result) {
primaryTabId = result.id;
sforce.console.getEnclosingTabId(openSubtab);
};
function openSubtab(result) {
var subTabId = result.id;
sforce.console.openSubtab(primaryTabId , '{!$CurrentPage.parameters.landingPage}', true,
'{!$CurrentPage.parameters.caseNumber}', subTabId);
};
function openPrimarytab(result) {
var primaryTabId = result.id;
sforce.console.openPrimaryTab(primaryTabId , '{!$CurrentPage.parameters.landingPage}', true,
'{!$CurrentPage.parameters.caseNumber}', null);
};
Regards,
Mahesh