Skip to main content Join the Agentforce Virtual Hackathon to build innovative solutions and compete for a $50k Grand Prize. Sign up now. Terms apply.
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');

  }

</script>

  

<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:pageBlockButtons> 

<apex:pageMessages id="msgs"/>

</apex:pageblock> 

</apex:form>

</apex:page>
4 个回答
  1. 2017年12月28日 16:36
    I'm assuming this is no longer an open question. However in your open primary tab function change the false to true:

      sforce.console.openPrimaryTab(null, '/apex/CanvasAppPage?scontrolCaching=1&id={!contact.ID}', true, 'ClientView', openSuccess, 'salesforceTab');

    that should make it work
  2. 2015年8月1日 05:16
    Thanks for your response..its not helpfull.  Your code and the code that i pasted does exactly the same..my issue is not opening a primarytab. issue is once i open a new primarytab focus needs to be shifted to th newly opend tab not the current one. if you look at the screenshot below once i click the clientview button its opening the new

    primarytab called vlientview but the focus is still on oldtab. i want the focus to be shifted to new tab. Thanks for your response..its not helpfull. Your code and the code that i pasted does exactly the same..my issue is not opening a primarytab.
  3. 2015年8月1日 05:04
    Hi,

    Please check below blog for more information in console related post:-

    http://amitsalesforce.blogspot.in/search/label/Console

    http://amitsalesforce.blogspot.in/2015/03/how-to-open-new-record-inside-console.html

    Include JS in VF page

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

    Write below Java Script code in VF page

    <script>

    function openTab(id, name)

    {

    if (sforce.console.isInConsole())

    sforce.console.openPrimaryTab(undefined, '/' + id + '?isdtp=vw', true, name);

    else

    window.top.location.href = '/' + id;

    }

    </script>

    Then use below link to open new record 

    <a href="⌗" onclick="openTab('{!Obj.id}''{!Obj.name}'); return false;">{!Obj.customKey}</a>

    Please let us know if this will help u

    Thanks

    Amit Chaudhary
0/9000