function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
llisallisa 

Custom List Button to Open Primary tab in Console

Hi All,

I have creates a custom button "New Test" of list type with Behaviour "Execute Javascript" and Content Source "Onclick Javascript" .

Requirement is to - By clicking this button it will open in console primary tab.
But with this code it will open in console subtab.
Kindly help me on this.

if (typeof(srcSelf) == 'function') { 
srcUp("/a0a/e?isdtp=vw","_blank"); 
}else{ 
window.open("/a0a/e?isdtp=vw","_blank"); 
}
NagendraNagendra (Salesforce Developers) 
Hi Llisa,

Please check with similar example below and modify it as per your requirement which should suffice your need.

Opens a contact in subtab:
if (typeof(srcSelf) == 'function') { 
     srcUp("/003/e?RecordType=012F0000001EvIo&accid={!Account.Id}&ent=Contact&retURL=/{!Account.Id}","_blank"); 
}else{ 
     window.open("/003/e?RecordType=012F0000001EvIo&accid={!Account.Id}&ent=Contact&retURL=/{!Account.Id}","_blank"); 
}

Opens a contact in primary tab;
if (typeof(srcSelf) == 'function'){
    srcUp("/003/e?RecordType=012F0000001EvIo&accid={!Account.Id}&ent=Contact&retURL=/{!Account.Id}","_blank"); 
 }else{
    if(sforce.console.isInConsole()){
        sforce.console.openPrimaryTab(null,'/003/e?RecordType=012F0000001EvIo&accid=' + '{!Account.Id}' + '&ent=Contact&retURL=/' + '{!Account.Id}', true);
    }
}

Mark this post as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are really in need of it.

Best Regards,
Nagendra.P