function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ravi Chandra Chevula 16Ravi Chandra Chevula 16 

Salesforce lightning custom label not getting updated even after page reload

I have an issue with Custom label behavior. I have created Custom Label to Show/Hide Custom Related list. This custom label is set to false for the first time. It is made true to test but still $Label.c.Switch gives false. I tried to clear cache, tried to reload the page many times and also tried with Private window mode. Sometimes It will be true and sometimes false.
Below is the code using Custom Label
<aura:if isTrue="{! $Label.c.Switch == 'true'}">
        <aura:if isTrue="{!v.failedToLoadDynamicComponent}">
            <h3>Failed to dynamically load Safety Letters related list.</h3>
            <aura:set attribute="else">
                {!v.body}
            </aura:set>
        </aura:if>        
        <aura:set attribute="else">
            <h3>Please make Switch to true to see records</h3>
        </aura:set>
    </aura:if>
Is anyone else facing this issue or has found a solution for it?
 
AnudeepAnudeep (Salesforce Developers) 
Hi Ravi, 

Changes to custom labels are not immediately reflected. As per the documentation updates to a label locale or translation are not immediately reflected in the application. To verify the change immediately, log out and in

My suggestion would be to ouput the label once and also put it in your controller to verify the value. Also, try using another label to see if you are facing the same issue. If you are, please engage support
 
<ui:outputText value=”{!$Label.c.LabelName}”/>

var desc = $A.get(“{!$Label.c.description}”);

If you find the above information helpful, please mark this answer as best. It may help others in the future. Thank You!

Anudeep
Barthelemy Laurans 1Barthelemy Laurans 1
Hi,

Activating the lightning debug mode will give you the ability to clear the cache (when you click on the up right tile that gives the number of kb loaded).

Also I don't really know what you're trying to achieve with your custom label switch but I would recommend to use design tokens (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_config_for_app_builder_design_files.htm) or custom settings. They are a lot more suitable to this.

Best regards,
Barthélemy