0

I am getting my tab as shown in screenshot below which is a component that gets displayed on clicking a quick action button . currently it is showing asterisk how can i show name on tab.enter image description here

1
  • please add the minimal required code to reproduce the error? Apr 21 '20 at 7:05
0

Use lightning workspace API to rename the tab label for the detailed document you can see the component library.

Here you go the code snippet for same

Test.Cmp

<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global">

<!--Attributes-->
<aura:attribute name="accFields" type="Account"/>

<!--Component Start-->

<!--Lightning Workspace API-->
<lightning:workspaceAPI aura:id="workspace"/>

<!--Lightning Force Data to get Account record-->
<force:recordData aura:id="accRecordData"
                  layoutType="FULL"
                  recordId="{!v.recordId}"
                  targetFields="{!v.accFields}"
                  recordUpdated="{!c.handleRecordUpdate}"/>
<!--Component End-->

Controller.JS

({
handleRecordUpdate: function(component, event, helper) {
    var accountFields = component.get("v.accFields");
    var workspaceAPI = component.find("workspace");
    workspaceAPI.getFocusedTabInfo().then(function(response) {
        var focusedTabId = response.tabId;
        workspaceAPI.setTabLabel({
            tabId: focusedTabId,
            label: accountFields.Type + ' - ' + accountFields.Name
        });
    })
}

})

You can call this method when you need to rename tab. Hope this will help you :)

4
  • i tried what you suggested but it gives error as : Uncaught (in promise) Error: Could not locate focused tab..
    – Abha
    Apr 21 '20 at 12:03
  • when you are calling this method Apr 22 '20 at 3:16
  • in init handler I want to rename the tab as soon as it starts loading , I want instead of loading icon as shown in picture my tab should be renamed.
    – Abha
    Apr 22 '20 at 4:20
  • can you please your code to see the issue as I can find in your code getFocusedTabInfo is returning undefined Apr 22 '20 at 9:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.