I have a list button on my Case layout in the Salesforce Console which opens up a Visualforce page containing support/search tools. We have recently picked up volume on Live Agent, surfacing the scenario of agents handling multiple "Inbound" cases at once. Current restrictions of the console prevent duplicate primary tabs from being created, preventing my agents from being able to open up multiple instances of the visualforce page.

How can I work around this limitation and create duplicate primary tabs in the salesforce console?

Below you will see what I'm currently using to open the primary tab from my List Button

if(sforce.console.isInConsole()) {
    sforce.console.openPrimaryTab(undefined, '/apex/PatientSearchConsole', true, 'Patient Search');
| improve this question | | | | |

To create a duplicate primary tab, you have to make the primary tab unique, so that the console doesn't identify each creation attempt as a duplicate of the first. The issue here is that the URL passed, /apex/PatientSearchConsole, will not be unique in the second request to create the tab from the button.

To work around this limitation, we have to modify the url passed to be unique every time the button is clicked. Since the page controller does not look for an id parameter in the url (replace id with most any string of choice), we can simply add a random parameter to the url when we create the primary tab. Using a fairly reasonable math.random(), we can generate a random number to use as our "fake" parameter to the page, making our end URL we pass to sforce.console.openPrimaryTab() unique.

if(sforce.console.isInConsole()) {
    var random = Math.floor((Math.random() * 10000) + 1);
    sforce.console.openPrimaryTab(undefined, '/apex/PatientSearchConsole?id=' + random, true, 'Patient Search');

enter image description here

| improve this answer | | | | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.