2

I am unable to open multiple tabs with a tabLabel but CAN open multiple tabs without a tabLabel. I can't find any documentation on why this would be happening or any further explanations on the (optional)tabLabel:String section of the openPrimaryTab() function. Any insight would be appreciated.

I have tried binding in a value, hard typing in a value, putting in a datetime and as far as I can tell, if there is any value in the tabLabel, then multiple tabs will not pop.

    sforce.console.openPrimaryTab(null, '/' + id, true, 
   '{!title}', openSuccess, 'Case On Case');

When I remove the tabLabel, I am able to get multiple tabs to pop.

sforce.console.openPrimaryTab(null, '/' + id, true, openSuccess, 'Case On Case');

Any ideas?

2 Answers 2

3

In this case, you need to specify undefined rather than defined as null in the first argument of

sforce.console.openPrimaryTab(***id:String***, url:URL, active:Boolean, (optional)tabLabel:String, (optional)callback:Function, (optional)name)

So, it will be as follows:

sforce.console.openPrimaryTab(undefined,"/"+id, true, '{!title}');

In the below picture you can see that clicking each record, it is opening in separate Primary tab with title.

Open Primary Tab

Updating answer based on comments

If the ID corresponds to an existing primary tab, the existing tab is redirected to the given URL because the Salesforce console prevents duplicate tabs.

Now, if you do not specify the Id then it should be undefined as there is difference between null and undefined

4
  • Interesting. What is the purpose of the ID:String? Something I also discovered is that the callback function throws the function off as well. This works: sforce.console.openPrimaryTab(undefined,"/"+id, true, '{!title}', 'Case On Tab'); this does not work sforce.console.openPrimaryTab(undefined, '/' + id, true, '{!title}', openSuccess, 'Case On Tab'); I should note that my callback function was just an alert with no other logic.
    – Olivia
    Mar 30, 2017 at 17:09
  • it has difference, updating answer at bottom Mar 30, 2017 at 17:18
  • Thank you for the update, that makes sense. I am now confused on why it would work with a NULL id and no tabLabel. How does the tabLabel effect the ID?
    – Olivia
    Mar 30, 2017 at 17:32
  • tabLabel is specified in the code, Id shouldn't be null Mar 30, 2017 at 17:35
1

Had faced the same behaviour in past with sforce.console.openPrimaryTab.

My conclusion is that it was a feature not a bug; as tabLabel is unique identifier of the tab or subTab, it behaves same as window name in window.open().

Unfortunately its not documented anywhere.

2
  • what did you end up doing? Do you think it's worth opening up a case with Salesforce? I feel like there has to be a way to open multiple tabs with a tabLabel.
    – Olivia
    Mar 30, 2017 at 16:54
  • @SantanuBoral awesome, I will wait for your reply!
    – Olivia
    Mar 30, 2017 at 16:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .