Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

lightning:tabReplaced

Indicates that a tab has been replaced successfully.

Response

Name Type Description
tabId string The ID of the replaced tab.

Example

This example prints a line to the browser’s developer console when a tab is replaced, and then returns that tab’s URL using the getTabURL() method.

Component code:

1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2    <lightning:workspaceAPI aura:id="workspace" />	
3    <aura:handler event="lightning:tabReplaced" action="{! c.onTabReplaced }"/> 
4</aura:component>

Controller code:

1({
2    onTabReplaced : function(component, event, helper) {
3        console.log("Tab Replaced");
4        var replacedTabId = event.getParam("tabId");
5        var workspaceAPI = component.find("workspace");
6        workspaceAPI.getTabURL({        
7            tabId : replacedTabId
8        }).then(function(response) {
9	     console.log(response);
10        });
11    }
12})