Skip to main content
Post Undeleted by Anutej
added 107 characters in body
Source Link
Anutej
  • 479
  • 3
  • 8

In Native SF when Tab or Subtab is closed you will beI have implemented force:hasRecordId and I was able to do that by subscribing to lightning:tabClosed

lightning:tabClosed is an application event that indicates a tab has been closed successfully. This event is supported in Lightning console apps only.log the case id can you check the code I used once:

Component:

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,flexipage:availableForAllPageTypes" access="global" >
    <lightning:workspaceAPI aura:id="workspace" />  
    <aura:handler event="lightning:tabClosed" action="{! c.onTabClosed }"/> 
    Case Id is {!v.recordId}
</aura:component>

Controller:

({
    onTabClosed : function(component, event, helper) {
        var caseId= component.get("v.recordId")
        var tabId = event.getParam('tabId');
        console.log("Tab closed: " +tabId);
       console.log("Case Id:" + caseId);
    } 
})

In Native SF when Tab or Subtab is closed you will be able to do that by subscribing to lightning:tabClosed

lightning:tabClosed is an application event that indicates a tab has been closed successfully. This event is supported in Lightning console apps only.

<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
    <lightning:workspaceAPI aura:id="workspace" />  
    <aura:handler event="lightning:tabClosed" action="{! c.onTabClosed }"/> 
</aura:component>

I have implemented force:hasRecordId and I was able to console log the case id can you check the code I used once:

Component:

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,flexipage:availableForAllPageTypes" access="global" >
    <aura:handler event="lightning:tabClosed" action="{! c.onTabClosed }"/> 
    Case Id is {!v.recordId}
</aura:component>

Controller:

({
    onTabClosed : function(component, event, helper) {
        var caseId= component.get("v.recordId")
        var tabId = event.getParam('tabId');
        console.log("Tab closed: " +tabId);
       console.log("Case Id:" + caseId);
    } 
})
Post Deleted by Anutej
Source Link
Anutej
  • 479
  • 3
  • 8

In Native SF when Tab or Subtab is closed you will be able to do that by subscribing to lightning:tabClosed

lightning:tabClosed is an application event that indicates a tab has been closed successfully. This event is supported in Lightning console apps only.

<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
    <lightning:workspaceAPI aura:id="workspace" />  
    <aura:handler event="lightning:tabClosed" action="{! c.onTabClosed }"/> 
</aura:component>