Currently we have a VF page as the Home page of Service Console and have a custom Button to create a new contact record . I would like to open this new contact page in a subtab when the button is clicked. Any sample code will be of great help as I am using Console for the first time.


You want the openPrimaryTab method.

Sample Code–Visualforce

<apex:page standardController="Case">

     <A HREF="#" onClick="testOpenPrimaryTab();return false">
         Click here to open a new primary tab</A> 

    <apex:includeScript value="/support/console/22.0/integration.js"/>
    <script type="text/javascript">
        function testOpenPrimaryTab() {
            //Open a new primary tab with the salesforce.com home page in it
            sforce.console.openPrimaryTab(null, 'http://www.salesforce.com', false, 
                'salesforce', openSuccess, 'salesforceTab');

        var openSuccess = function openSuccess(result) {
            //Report whether opening the new tab was successful
            if (result.success == true) {
                alert('Primary tab successfully opened');
            } else {
                alert('Primary tab cannot be opened');



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.