0

I have a lightning home component outside lightning service console. I want to open a record in a tab on service console Up on clicking a button of this component. I have tried following code, but it returns nothing. This is basically the code provided by SFDC devs,

<aura:component implements="flexipage:availableForAllPageTypes" access="global">
        <lightning:workspaceAPI aura:id="workspace"/>
        <lightning:button label="Open Tab" onclick="{!c.openTab}"/>
</aura:component>

And the controller;

({
    openTab : function(component, event, helper) {
        console.log('clicked');
        var workspaceAPI = component.find("workspace");
        workspaceAPI.openTab({
            recordId: '0030S00000D90lBQAR',
            focus: true
        }).then(function(response) {
            workspaceAPI.getTabInfo({
                  tabId: response
            }).then(function(tabInfo) {
            console.log("The url for this tab is: " + tabInfo.url);
            });
        })
        .catch(function(error) {
               console.log(error);
        });
    }
})

Am I missing anything? Or else is there any other way that I can do this?

Your Answer

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

Browse other questions tagged or ask your own question.