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
priyanshu chaudharypriyanshu chaudhary 

sforce.console. getFocusedPrimaryTabId() return "undefined"

On click of Case Number from anywhere in service console I have to redirect user from case service console to a VF page. The VF page should load 1st and once the user submit their consent then only standard console case view should open.All this need to be done in same Primary Tab. I used an inline VF page on case layout which should redirect to VF page and then to case record standard console view. I create the redirect link in extension class. I am using below javaScript in inline vf page to redirect to another vf: 

if(sforce.console.isInConsole()){
console.log('Tab Id: '+sforce.console.getFocusedPrimaryTabId(TabId));
sforce.console.openPrimaryTab(,'{!redirectUrlConsole}',true);

 

redirectUrlConsole is the relative url constructed in extension class But I am not receiving the tab id , it is coming undefined so the vf page is loading in another primary tab. What is wrong with the code ?

 

User-added image

ShirishaShirisha (Salesforce Developers) 
Hi Priyanshu,

Greetings!

 I would suggest you to debug this using debugger to see,when the TabId becomes undefined and till when we can store the TabId so that we can store it in one variable before we are working with the VF page.

Lightning inspector:https://chrome.google.com/webstore/detail/salesforce-lightning-insp/pcpmcffcomlcjgpcheokdfcjipanjdpc?hl=en

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri