You need to sign in to do that
Don't have an account?
Service cloud console: can't open subtab from javascript in VF
I have an VF page on Account and after completing process, it redirects to another page which should open the newly created child object in subtab and current page should redirect to parent object.
here is the code for opening subtab from 2nd page:
<apex:page standardController="Account" extensions="SubscriptionExtController">
<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript">
var primaryTabId = '{!accID}';
function testOpenSubtab() {
//First find the ID of the primary tab to put the new subtab in
sforce.console.getEnclosingPrimaryTabId(openSubtab);
}
var openSubtab = function openSubtab(result) {
//Now that weve got the primary tab ID, we can open a new subtab in it
sforce.console.openSubtab(primaryTabId, '{!$Site.Prefix}/{!retId}', true, 'New Payment', null, openSuccess, 'newcaseSubtab');
};
var openSuccess = function openSuccess(result) {
//Report whether we succeeded in opening the subtab
if (result.success == true) {
alert('subtab successfully opened..');
} else {
alert('subtab cannot be opened..');
}
};
testOpenSubtab();
</script>
</apex:page>
Here both 1st and 2nd page are using same class as extension and retId, accId are populated from 1st page[both are assigned properly].
The problem is that it is alerting "subtab cannot be opened.."
What should be done?