You need to sign in to do that
Don't have an account?
![Mohammed Azarudeen Mohammed Azarudeen](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
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.
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](/forums/servlet/rtaImage?eid=9060G000000XfF8&feoid=Body&refid=0EM0G000000c0uZ)
<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 sforce.console.getEnclosingPrimaryTabId(openSubtab); } 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 = result.id; sforce.console.openSubtab(primaryTabId , rmaurl, true, 'RMA', null, null, 'salesforceSubtab'); }; </script> <apex:repeat value="{!listOfRMA}" var="RMAs"> <tr class="spaceUnder"> <td> <label class="labelCol">RMA Number</label><br/> <a href="{!$Site.Prefix}/" id="rmaID" onClick="testOpenSubtab('{!RMAs.id}');return false;" style="text-decoration: none;"><apex:outputText id="rmaName" value="{!RMAs.Name}"/></a> </td> </tr> </apex:repeat>
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.
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');
I solved this mystery. In the Javascript method, I put null in the last parameter of the console.openSubtab. I got the solution from this reference of salesforce
openSubtab()
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.
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