0

I am trying to utilise the lightning:tabClosed event within my LEX component on a Case. I want to be able to get the record ID for the tab that was closed, as I need to do some processing using that information.

What I am finding is that when the lightning:tabClosed event fires, I am unable to use getTabURL() and getTabInfo() as I get the following errors (in no particular order):

Uncaught (in promise) Error: getTabURL() - Failed to get URL for tabId ctab1 Uncaught (in promise) Error: getTabInfo() - Failed to get URL for tabId ctab0

null "Error: getTabInfo() - Failed to get tabInfo for tabId ctab0" null "Error: getTabURL() - Failed to get tabInfo for tabId ctab1"

Following is an example of my code:

    var closedTabId = event.getParam('tabId');
    console.log("%% 1 - Tab Closed Id = " + closedTabId);

    var workspaceAPI = component.find("workspace");

    workspaceAPI.getTabInfo({
        tabId: closedTabId
    }).then(function(response) {
        alert(response.recordId);
    });

It almost seems like because the tab closes as part of this event, we lose access to that information.

I look forward to seeing your responses.

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.