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

{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")}
{!REQUIRESCRIPT("/soap/ajax/25.0/integration.js")}

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

testGetFocusedPrimaryTabId();

// END of the CODE

Error thowing - can not read property getFocusedPrimaryTabId in salesforce

Regards,
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

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


{!REQUIRESCRIPT("/soap/ajax/36.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/36.0/apex.js")} 
{!REQUIRESCRIPT("/soap/ajax/36.0/integration.js")} 

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

sforce.console.getFocusedPrimaryTabId(function(enclosingResult){
sforce.console.openSubtab(enclosingResult.id, url, true, '', null);
});


Still i am getting the same error message.

Please do help.