0

I'm experiencing a weird js error while trying to run the openSubtab() salesforce console integration API method.

This is my method call :

sforce.console.openSubtab(ctiTabId, theURL,true,'{!Case.caseNumber}',function(result){
     if(result.success){
        //some custom logic
     }else{
        some other custom logic
     }
},'{!Case.caseNumber}');

The error I get is the following:

openSubTab: Invalid ID: scc-st-0

Now, the strange thing is : ctiTabId param refers (it's the one in the image below) to what I expect to be a primary tab, not a subtab itself. Instead, the system sees is as a subtab, avoiding me to open a subtab under it, of course.

So at this point the question would be: why is my primary tab interpreted as a subtab?

enter image description here

  • 1
    Can you please share how you get ctiTabId in the first place? – Adrian Larson Sep 6 '16 at 16:20
1

What your screenshot shows is indeed a primary tab 'Mario Rossi'. But what you don't see is that there is actually a 'Details' subtab contained within that primary tab. Were you to open additional subtabs you would then see the 'Details' subtab shown like this:

enter image description here

My assumption is you're using a method like getEnclosingTabId() to get the tab ID before passing it into openSubtab, and it's getting the ID out of the subtab because that's where it's actually running. I'd suggest using something like getEnclosingPrimaryTabId() or getFocusedPrimaryTabId() which is sure to return the primary tab ID.

  • thanks, it worked! I was using getEnclosingTabId.. the getEnclosingPrimaryTabId, instead, gives me the right primary tab id as well! – user9959 Sep 7 '16 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy