+ Start a Discussion
Soumya BeheraSoumya Behera 

Trying to Open a subtab on click on a buttin :- Caught with error >> "can not read property getFocusedPrimaryTabId in salesforce"

Hi All,

The expected scenario is on click of a button it should open a subtab in the service console.
Below is the code which i have put in the button java script code. However its not working and throwing the below error. Please do help.

// Start of the CODE


function testGetFocusedPrimaryTabId() {
var showTabId = function showTabId(result) {
 alert('Tab ID: ' + result.id);


// END of the CODE

Error thowing - can not read property getFocusedPrimaryTabId in salesforce

Soumya Behera

Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help you
1) http://amitsalesforce.blogspot.com/search/label/Console
2) http://amitsalesforce.blogspot.com/2015/03/how-to-open-new-record-inside-console_3.html

Let us know if this will help  you

Amit Chaudhary
Soumya BeheraSoumya Behera
As i have check from the several blog , i have used the below code 


var url=encodeURI('https://salesforce.com'); 

sforce.console.openSubtab(enclosingResult.id, url, true, '', null);

Still i am getting the same error message.

Please do help.