0

I am using the openPrimaryTab() method to open a custom page as tab.

<script src="/support/console/43.0/integration.js" />
<script type="text/javascript">
    function OpenPrimaryTab() {
        //Open a new primary tab with the appropriate case 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');
        }
    };
</script>

Its working in Console Navigation in Salesforce lightning view. But its not working in Standard Navigation in Salesforce lightning view.

1

Lightning already offers lightning:workspaceAPI, which provides access to console controls.

Here you can see an example:

({
   openTab : function(component, event, helper) {
       var workspaceAPI = component.find("workspace");
       workspaceAPI.openTab({
           url: '#/sObject/001R0000003HgssIAC/view',
           focus: true
       });
   },
})

See the reference here.

  • Thanks for update. Without any components its possible to open new tab in Salesforce lightning standard navigation. – Viji May 14 '18 at 13:35

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.