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
ForcecodeForcecode 

Custom label in formula field and managed package issue

I hope it is ok to post this here, because it has to do with a managed package.

 

In the dev org of our managed app I create a custom formula field on one of our custom objects.

 

When I reference a custom label in the formula,  I always get a blank field. I used the 'Insert field' dialog to add this:

 

$Label.myNamspace__myCustomLabel

 

There is no error upon saving so I think the custom label is recognized as valid but when I add the field to the listview, it is empty.

 

I tried the protected/unprotected checkbox for the label but with no effect.

 

Is this supported or is it a bug ?

 

Is the custom label added to the package when I uploaded it (as for VF pages), because I cannot add it manually.

 

Thanks.

shillyershillyer

Is the custom label added to the package when I uploaded it (as for VF pages), because I cannot add it manually.

 

 

Yes - it is added implicitly when the component (Visualforce page, Apex Code) is added.

 

Hope that helps,

Sati

ForcecodeForcecode

Thanks Sati,

 

but we only reference the label in a custom formula field, no Apex code or VF page.

 

Don't know if the packaging process looks there as well.

As I said, referencing a custom label in a formula field is not working for a managed package and I think it is a bug.

A_SmithA_Smith

This does seem like a bug.  I would suggest logging a case with all the details.  

 

A_SmithA_Smith
Actually, no need to log a case.  We were able to reproduce the issue. 
A_SmithA_Smith

The workaround for now is to uncheck the protected checkbox on the custom label.  Then it will work correctly and should package correctly.

 

 

ForceMantis (Amit Jain)ForceMantis (Amit Jain)

Where can I find "Protected" check box. It doesn't appear on label create or edit screen


A_Smith wrote:

The workaround for now is to uncheck the protected checkbox on the custom label.  Then it will work correctly and should package correctly.

 

 


 

Sachin KulkarniSachin Kulkarni

Unchecking the protected component checkbox doesn't solve the issue.

im_danim_dan

I was able to solve this by adding a reference in one of my visualforce pages.

<apex:outputText value="{!$Label.Label_API_Name}" rendered="false" />

 If you don't have any visualforce pages, create a visualforce component (because it can later be deleted from the managed package) with the same references

 

jahnvi shukla 10jahnvi shukla 10
Have you resolved the issue? If yes, can you please share the best way to solve it.