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
Mohammed AzarudeenMohammed Azarudeen 

console.openSubtab links are opening in same sub tab

In the console view I have added visualforce page to show related RMAs for the current case in the right side bar of the console. I am allowing users to click on RMA link and opening the link in subtab of the current case. Am using the openSubtab javascript method and calling it in RMA link.
<script type="text/javascript">
        var globalRMAID = '';
        function testOpenSubtab(RMAId) {
            globalRMAID = RMAId;
            //First find the ID of the primary tab to put the new subtab in
        var openSubtab = function openSubtab(result) {
            //Now that we have the primary tab ID, we can open a new subtab in it
            var rmaurl = document.getElementById("rmaID").href;
            rmaurl = rmaurl+globalRMAID;
            var primaryTabId =;
            sforce.console.openSubtab(primaryTabId , rmaurl, true, 
                'RMA', null, null, 'salesforceSubtab');

<apex:repeat value="{!listOfRMA}" var="RMAs">
<tr class="spaceUnder">
         <label class="labelCol">RMA Number</label><br/>
         <a href="{!$Site.Prefix}/" id="rmaID" onClick="testOpenSubtab('{!}');return false;" style="text-decoration: none;"><apex:outputText id="rmaName" value="{!RMAs.Name}"/></a>

If there is only one RMA is associated with case then if user clicks on it, it is opening well in subtab. But if I have another RMA below then when user clicks on it, it is ovverriding the already opened rma and showing on the same previous subtab.

User-added image
Lalit Mistry 21Lalit Mistry 21
Hi Mohammed Azarudeen,
replace your openSubTab method call with below script (i.e. pass subtab id to recognize as new subtab)
sforce.console.openSubtab(primaryTabId , rmaurl, true,'RMA', globalRMAID, null, 'salesforceSubtab');
Mohammed AzarudeenMohammed Azarudeen

I solved this mystery. In the Javascript method, I put null in the last parameter of the console.openSubtab.
sforce.console.openSubtab(primaryTabId , rmaurl, true, 'RMA', null, null, null);
I got the solution from this reference of salesforce
Opens a new subtab (within a primary tab) that displays the content of a specified URL, which can be relative or absolute. You can also override an existing subtab. Use to open a new subtab on a primary tab via the primary tab's ID.

id | string | ID of the subtab to override.
   |          | Use null to create a new subtab.
Hi Mohammed,

I have similar requirement where I need to open subtab and display some data. I have created the Visualforce page and getting the primary tab id and passing it to opensubtab method. I would like to know how to show the link (RMA which you have displayed beside Details) in the console.

Thanks for the help