1

I currently have a LWC that is embedded within an Aura component. When a user clicks a button on the LWC it will convert a lead and return the new account id. The the Aura component is supposed to then close the lead tab (current tab) and open (then focus) on the new account tab. I have been able to make it so the lead tab closes and the account tab opens but it does not focus on the newly opened tab.

Here is the code for the Aura component:

    openTab: function(component, event, helper) {
        
        console.log('Opening Tab 2');
        component.set('v.recordId', event.getParam('value'));
        console.log('Record Id:' + component.get('v.recordId'));
        var recId = component.get('v.recordId');
        console.log(recId);

        var workspaceAPI = component.find("workspace");
        workspaceAPI.openTab({
            recordId: recId,
            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('oh no: ' + error);
            });
        })
        .catch(function(error) {
               console.log(error);
        });
        console.log('Tab Opened');
    }
})

When Logging, I see the record ids in console but do not see anything after the console.log(recId).

Any assistance that can be provided would be appreciated.

Thanks,

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.