+ Start a Discussion
PalakPalak 

setTabIcon in Service Console

Hi All,

 

My requirement is to set the icon on the tab, when visualforce page is loaded in service console.

 

I have tried to implement it using the following link:

 

http://www.salesforce.com/us/developer/docs/api_console/Content/sforce_api_console_settabicon.htm

 

sforce.console.setTabIcon('/img/icon/microphone16.png', null, checkResult);

 

I have inlcuded the following script :

<apex:includeScript value="/support/console/28.0/integration.js"/> and also changed the version of the page as well as controller to 28.0 .

 

Still this setTabIcon is not working for me.

 

Please help me.

 

Any help would be appreciated !!!

 

Thanks & Regards

Palak Agarwal

NenzSCLoveNenzSCLove

 

I've noticed flukyness here and there with this api. Mostly wrestling with cross domain security restrictions. The fact that VF is served from a different domain is a complete PITA. 

 

I have been able to set tab titles but not in all circumstances.. it's difficult to give you a solutions without known the entire environment unfortunately. 

 

Note. you can't really touch the left nav bar.  You can't refresh VF tabs. Here is some tab icon code that worked for me.  Don't ask me why.. It's been more trial and error for me as the core SFDC js libraries are not the easiest to interpret. 

 

I list, what may appear to be, superfulous tags below as it seems if the wind blows on this stuff it breaks so I wanted to make sure I gave you all possible options.

 

Good luck and may the force be with you. :)

 

Thanks

 

 

<apex:page standardController="Contact" extensions="ctrlClient," 
tabStyle="Client__tab"
showHeader="true" 
sideBar="false"
action="{!doInit}"
title="Client">

...
<apex:includeScript value="/soap/ajax/28.0/connection.js"/>
<apex:includeScript value="/support/console/28.0/integration.js"/> 
..
<script>
function setTabIcon() {       sforce.console.setTabIcon('/img/icon/people16.png',null);    
}

var previousOnload = window.onload;       

window.onload = function() {
   if (previousOnload) {
       previousOnload();
   }
   setTimeout('setTabIcon()', '500'); 
}; 
</script>

 

 

 

mendy kurantmendy kurant


You need to add this:

      <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"/>
      <script src="//code.jquery.com/jquery-1.10.2.js"></script>
      <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
Tarun Khandelwal 11Tarun Khandelwal 11
sforce.console.getEnclosingPrimaryTabId(function(result){
   sforce.console.setTabTitle(accountName, result.id);
   sforce.console.setTabIcon("/img/icon/accounts16.png", result.id);
});

This seem working for me.
Pradeepkumar Dani 5Pradeepkumar Dani 5
I made it to work along with title. Please follow code snippet given below:
 
<apex:includeScript value="/support/console/30.0/integration.js"/>
    <script type="text/javascript">
    window.onload = function onloadJS() 
    {
        //alert('INIT');
        if (sforce.console.isInConsole()) 
        {
            //alert('in console');
            sforce.console.setTabTitle('Sample Title');
            sforce.console.getEnclosingPrimaryTabId(setTabIcon);
        } 
        else 
        {
            //alert('not in console');
        }
        
        function setTabIcon(result)
        {
            sforce.console.setTabIcon('/img/msg_icons/confirm16.png', result.id, checkResult);
        }
        
        function checkResult(result) 
        { 
            if (result.success) 
            {
               //alert('Tab icon set successfully!');
            } 
            else 
            {
               //alert('Tab icon cannot be set!');
            }
        }
    }
    </script>

hope this works!! Cheers!!