1

I am able access the custom labels created in my org, using Apex, but not the custom labels from a managed package installed in my org. The documentation does not have a specific example to access namespaced custom labels in Apex. I am developing lightning components in a developer edition org (not scratch org).

I have tried the following ways:

System.Label.namespace.CustomLabelName System.Label.namespace__CustomLabelName Label.namespace.CustomLabelName Label.namespace__CustomLabelName

and got the following error message:

External string does not exist: CustomLabelName

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/labels_apex.htm

Has anybody been able to access packaged custom labels from outside the package?

3
  • 1
    Label.namespace.labelname or System.namespace.labelname is the correct syntax. Whatever is going on is something else.
    – sfdcfox
    Jan 22, 2019 at 3:45
  • 1
    +1 to comment posted by sfdcfox. Check if the label is "protected" Sep 16, 2019 at 15:40
  • @SalesforceArchitect Looks like that was the issue. Thank you! Sep 18, 2019 at 22:01

1 Answer 1

3

As noted in the comments...

The correct syntax is System.Label.Namespace.CustomLabelName.

This also requires the managed CustomLabel to have protected set to false so the subscriber org can access it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .