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
PipeCovePipeCove 

focusPrimaryTabByName not working in Service Cloud Console...?

Hi,

 

I cannot get this function to work on my Visualforce page, nothing happens when I press the button that calls this method.

 

I have extracted the code just for this function:

<script type="text/javascript">
    function openGroupView() {  
        sforce.console.openPrimaryTab(null, '/apex/Group', true, 'Groups', null, 'GroupTab');
    }
        
    function focusGroupView() {
        sforce.console.focusPrimaryTabByName('GroupTab');
    }
</script>

 Here is the (extracted) code for the buttons:

 

<apex:form>
    <apex:pageBlockSection>
<apex:pageBlockSectionItem >
         <apex:commandButton id="groupButton" onclick="openGroupView();" value="Open GroupView"/>
        </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:commandButton id="groupButtonFocus" onclick="focusGroupView();" value="Focus GroupView"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:form>

The 'groupButton' works fine, but the 'groupButtonFocus' do not work.

Do anyone know if this is an issue within Salesforce or the Service Cloud Console? Just for the record, I haven't tried this on anything else than the Service Cloud Console, since that's what we are currently working on.

kiranmutturukiranmutturu

just to cross check

 

change your function like below and see

 

function focusGroupView() {
sforce.console.focusPrimaryTabByName('GroupTab',focusSuccess);
}


var focusSuccess = function focusSuccess(result) {
//Report whether going to the primary tab was successful
if (result.success == true) {
alert('Going to the primary tab was successful');
} else {
alert('Going to the Primary tab was not successful');
}
};

PipeCovePipeCove

When using your callback function I do not get any of the two alert boxes, although I can see that the JavaScript function is called (added a log message in the console).

kiranmutturukiranmutturu

what is the API verion script that u r using ? like highleted below

 

<apex:includeScript value="/support/console/22.0/integration.js"/>

PipeCovePipeCove

We are using API version 26.0

<apex:includeScript value="/support/console/26.0/integration.js"/>

Shefali Vinchurkar2Shefali Vinchurkar2
Hi PipeCove

Did you find a solution for this?