+ Start a Discussion
JayaJayaJayaJaya 

Urgent Please: How to open a subtab in Service Console on button click?

Hi,

 

In Service Console, I have created a custom button in lead detail page. On click of that button, I need to open a Service Console subtab(passing the lead Id). Please let me know how to achieve this. I dont know much about Service Cloud.

Its very urgent, so a immediate response is very very helpful to me.  Thanks a lot.

 

--Jaya.

Best Answer chosen by Admin (Salesforce Developers) 
Jerun JoseJerun Jose
Have the custom button execute onclick javascript. Have the javascript code as

srcUp('UrlOfTheNewTabGoesHere');

This approach is not documented. It just uses the existing mechanism that the standard links on the detail page use to open windows as subtabs.

Let me know if you need more help on this.

All Answers

Jerun JoseJerun Jose
Have the custom button execute onclick javascript. Have the javascript code as

srcUp('UrlOfTheNewTabGoesHere');

This approach is not documented. It just uses the existing mechanism that the standard links on the detail page use to open windows as subtabs.

Let me know if you need more help on this.
This was selected as the best answer
JayaJayaJayaJaya

Thanks Jerun for your response.

PalakPalak

Hi 

 

Could you please help me set the tab label using scrup?

 

Its Urgent !!

 

Thanks in advance 

 

Regards

Palak 

Jerun JoseJerun Jose

I dont think the srcUp function defines the tab name. The tab name is from the page that is being opened in the subtab

Vikash TiwaryVikash Tiwary

Hi Jaya

 

you will be able to set sub tab name just by passing tab name as a parameter to openSubTab() standard method.Here is an example:

 

function openSubtab(subtabUrl, subTabTitle)

        {

       

           // Use the results primary tab id and open a new subtab

           var openSubtab = function(result)

           {            

                sforce.console.openSubtab(result.id, subtabUrl, true, subTabTitle, null);    

           };

           sforce.console.getEnclosingPrimaryTabId(openSubtab);

         }

 

result.id - id of primary tab under which subtab is to be opened.

SubTabUrl- url for subtab

true- sets focus on the sub tab opened.

SubTabTitle- This sets your required SubTab Name

null- indicates that new subtab will be opened insted of overriding existing tab.

 

Happy if it helps.

 

Thanks

PalakPalak

Hi Vikas, 

 

Thanks for your response !!!

 

Could you please help me in getting the id of primary tab under which subtab is to be opened?

 

Thanks in advance !!

 

Regards

Palak Agarwal

Vikash TiwaryVikash Tiwary

See code commentation for the description below. 

 

//This line itself fetchs the primary tab id and calls openSubtab function along with the fetched id. Below alerted value gives you primary tab id.

sforce.console.getEnclosingPrimaryTabId(openSubtab);

 

 // Use the results primary tab id and open a new subtab

           var openSubtab = function(result)

           {      

                // This alerted id is itself primary tab id.

                alert(result.id);

                sforce.console.openSubtab(result.id, subtabUrl, true, subTabTitle, null);    

           };

 

for details refer to        

http://www.salesforce.com/us/developer/docs/api_console/api_console.pdf

 

Let me know if your query is resolved.

 

Thanks

DevelopersDevelopers

Hi All,

 

I am trying to implement the same in my project. when clicking on the custom button, i am getting the error like:

 

"URL doesnot exist."

For subTabURL, how to set the url value.

 

 

can anyone please support in this?

 

Regards,

kumar

Santosh Kumar Sriram 2310Santosh Kumar Sriram 2310
I hope you had added  <apex:includeScript value="/support/console/22.0/integration.js"/> in your tag. The method you used for service console, mentions the version it is support with in the console/version/integration.js.

 
OzZiE90OzZiE90
Hi all,

I have been doing some research on my issue but have come up empty handed. I am using the srcUp() function on a custom button to open an external page. However, when the subtub opens, nothing loads (see picture below). The domain is whitelisted in the app. Any suggestions is greatly appreciated. Thank you.

User-added image
Force.comForce.com
Hi - Did you figure out the issue on the blank screen ?
sheetal agrawalsheetal agrawal
Hi,

I need to open a custom page in new tab inside Console-
Below code is opening the tab in complete new tab i.e ouside console in salesforce

if(sObjName=='Case'){
                SObject record = Database.query('Select CaseNumber From ' + sObjName + ' Where Id = :subOrderId');
                extractName= record.get('CaseNumber');
                c.Re_send_email_Link__c='<a href=' +System.URL.getSalesforceBaseUrl().toExternalForm()+'/'+subOrderId+' >'+extractName+'</a> <br/>';



Please help  
Sourabh Yerawar BrillioSourabh Yerawar Brillio
Hi,

Can we do this lightning console app as well? If yes, please provide details.