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
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: ' +;


// 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

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(''); 

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

Still i am getting the same error message.

Please do help.