• Shefali Vinchurkar2
  • 0 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
  • 2

I have made a hyperlink to open a primary tab with the help of javascript (having openPrimaryTab  console method)embedded in the hyperlink function of salesforce formula field. The openPrimaryTab consoel method works fine without the focusPrimaryTabByName method, but the focusPrimaryTabByName doesn't work as expected

Below is the code used:

HYPERLINK("javascript:var html_doc = document.getElementsByTagName('head')[0];var js=document.createElement('script');js.setAttribute('type','text/javascript'); var custName ='"&  Customer__r.FirstName& ' '&Customer__r.LastName &"';js.setAttribute('src','/support/console/31.0/integration.js');html_doc.appendChild(js);js.onload= function() {sforce.console.focusPrimaryTabByName(custName, focusSuccess); var focusSuccess = function focusSuccess(result){if (result.success == true) {}else{sforce.console.openPrimaryTab(null, '/"& Customer__c &"' , true, '"&  Customer__r.Name &"',null,'"&  Customer__r.Name &"' );}} ;}; ", Customer__r.FirstName+' '+ Customer__r.LastName ,"_blank")
If I define 3 actions in process builder at the same time : email alerts, Create a record,submit for approval. Is there any order which one wil get executed first? Or it will be as I specify it?
using "sforce.console.openPrimaryTab" im opening a new primary tab in console and its a opeing a tab successfully. but i want to navigate automatically to new primary tab. is it doable in the console?

here is my code snippet.

<apex:page standardController="contact" extensions="XXXX" standardStylesheets="false">

<apex:includeScript value="/support/console/31.0/integration.js"/>
<script type="text/javascript">
 function OpenClientViewTab() {
 //Open a new primary tab with the ClientView home page in it
  sforce.console.openPrimaryTab(null, '/apex/CanvasAppPage?scontrolCaching=1&id={!contact.ID}', false,'ClientView', openSuccess, 'salesforceTab');
<apex:form id="myform"> 
<apex:pageblock >  
<apex:pageBlockButtons location="Top"> 
<apex:commandButton value="Client View" onclick="OpenClientViewTab();return false"  styleClass="buttonStyle" style="background:LightBlue;width:80px;float:Center;" /> 
<apex:pageMessages id="msgs"/>



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() {

 Here is the (extracted) code for the buttons:


<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.