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
Kanteti@LT50DemoKanteti@LT50Demo 

Issue opening multiple primary tabs in Service Cloud Console from a custom console Component

Hello Everyone,

We are creating a product that should work very much like the "LiveAgent" . We want to implement a functionality to open multiple primary tabs from a visualforce page created as a custom Service cloud console. In the visualforce page, we have different sections with the "Accept" Button much like the one you see in a LiveAgent during which we are running into an issue with the Service cloud openPrimaryTab API method. I have placed a simple visualforce page in a custom console component and am opening the multiple primary tabs using the below API from service console integration tool kit.

“ sforce.console.openPrimaryTab(null, '/apex/LiveText?id='+recordId, true, 'Chat-'+recordId, openSuccess, 'salesforceTab’); “

The tab opens fine the first time, but from the next time (i.e., when I click on Accept button for the second time) , Since the URL (apex/LiveText) being provided to the openPrimaryTab API is the same (Note: I tried to make the url different by passing the record id, but it does not work), it is rendering the second/ new tab in the existing primary tab.

We have also tried to generate a URL (https://na17.salesforce.com/console#/apex/LiveText?id=a00o0000001DjEzAAK|/001/e|/003/e|/500/e|/00Q/e) with the primary and sub tabs together and tried to open with the Window.open and still the result is same. It just renders the new tabs in the existing open primary tabs.

We have seen this behavior when we open a case record. If a new tab is opened with the case, while there is a tab open with the same case record, instead of opening a new tab, it just renders in the existing tab but not sure if this is the same behavior we should expect with the visualforce pages?

Did anyone run into this issue before and if Yes, how can we resolve it.

*** Opening multiple sub-tabs works fine, but the issue persists with the primary tabs.

Thanks,
Prudhvi Kanteti
ezdhanhussainezdhanhussain
HI Prudhvi, Did you found any solution for above issue.. I am also facing similar problem. If found Kindly help me ..
ezdhanhussainezdhanhussain
Hi found solution for this.. thought of sharing it...

Previous code in which i faced issues
<script type="text/javascript">
function opentab(val) {
//Open a new primary tab with the salesforce.com home page in it
var idreceived = document.getElementById(val).value;
sforce.console.openPrimaryTab(null, '/'+idreceived, false,
'salesforce', openSuccess, 'salesforceTab');
}
var openSuccess = function openSuccess(result) {
//Report whether opening the new tab was successful
if (result.success == true) {
alert('Primary tab successfully opened');
} else {
alert('Primary tab cannot be opened');
}
};
</script>
<apex:pageblockTable value="{!myaccounts}" var="a"> 
  <apex:column width="50%"  >
	<span id="spanid">
		<apex:inputHidden value="{!a.id}" id="targetid"/>
	</span>
		<apex:commandlink styleclass="mylink" onclick="opentab('{!$Component.targetid}');return false">
			<apex:outputField value="{!a.name}" id="name" />
		</apex:commandLink>      
  </apex:column>
</apex:pageblocktable>
New code which solved my problem and open numerous tabs on click

<script>
function opentab(val,name){
alert('HI');
var idreceived = document.getElementById(val).value;
var namereceived = document.getElementById(name).value;
alert(idreceived);
sforce.console.openPrimaryTab(null, '/'+idreceived, true, 
                namereceived , openSuccess, namereceived );
}
var openSuccess = function openSuccess(result) {
//Report whether opening the new tab was successful
if (result.success == true) {
alert('Primary tab successfully opened');
} else {
alert('Primary tab cannot be opened');
}
}
</script>
 <apex:pageblockTable value="{!myaccounts}" var="a"> 
    <apex:column width="50%"  >
     <span id="spanid">
		<apex:inputHidden value="{!a.id}" id="targetid"/>
     </span>
     <apex:commandlink styleclass="mylink" onclick="opentab('{!$Component.targetid}','{!$Component.name}');return false">
		<apex:outputField value="{!a.name}" id="name" />
	 </apex:commandLink>
       
    </apex:column>
</apex:pageblockTable>

The issue was at this line 
sforce.console.openPrimaryTab(null, '/'+idreceived, false,
'salesforce', openSuccess, 'salesforceTab');
The label and name are crucial this are the values on which salesforce renders tabs.. so if this are different every time a new is opened every time..

Hope this Resolves this issue...

Neeharika PolisettiNeeharika Polisetti
Hi All,

We have a requirement, where on click of an Account name from list view, mutliple tabs must be opened in Service cloud console, with the Account's parent in one tab followed by the selected Account in another tab. Can anyone provide some pointers on how to open mutliple tabs at once in Service cloud console?

Thanks in advance
ezdhanhussainezdhanhussain
Hi neeharikha,

Can you elaborate your query.. have you developed custom code or using existing standard list view of salesforce console ?
Neeharika PolisettiNeeharika Polisetti
Hi Hussain,

Thanks for the response. 
To elaborate, I would like to view an Account in Service cloud. While the Account detail page (Standard) opens up, I want to open the Account's parent tab to the left and it's parent (if exists) to the left. 

Basically, Would like to open mutliple tabs at once in Service cloud on one click. i.e Tab1<Parent's Parent Account> , Tab2 <Parent's Account> , Tab3 <Account the user want to view>

Please let me know, if you need more information  and provide pointers if any. 

Thank you in advance

Regards,
Neeharika
ezdhanhussainezdhanhussain
Hi Niharika,

You can go like this. onclick of your account.
  • Execute a javascript function and Query for Account, Parent and Grand Parent. 
  • Save your results in an Array. index 0 has Grand Parent, index 1 has Parent, index 2 has Child Record.
  • Now run a loop for this array and execute sforce.console,openPrimaryTab() function
    for (var i = 0; i < myarray.length; i++) {
       
    sforce.console.openPrimaryTab(null, '/'+myarray[i].id, false, 'salesforce', openSuccess, 'salesforceTab');
    
    }
    Hope this resolves your Query