CustomLabels defines a bundle of reusable text values that can be localized for different languages, countries, and currencies. Apex classes and Visualforce pages can reference individual labels, keeping application text separate from the code or markup that displays it.
The plural CustomLabels bundle and the singular CustomLabel definition have distinct identities in package.xml, the Metadata API manifest that selects components for retrieval or deployment. Use the plural type for retrieving all labels and the singular type for selecting labels by name. Additional-language translations belong to separate Translations metadata, not to the master label bundle.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName on the bundle |
Identifies the custom label bundle. This inherited field is required when creating, updating, or deleting the bundle through metadata operations. It is not an individual label's name. |
labels |
The array of CustomLabel definitions contained in the bundle. |
fullName within labels
|
Identifies an individual label. Required when creating, updating, or deleting that label. Use this name as the manifest member for selective retrieval with CustomLabel. |
language |
Required. Identifies the language of the label's text. Additional-language translations are maintained separately. |
value |
Required. The label text, limited to 1,000 characters. The master value is stored in CustomLabels.labels. |
protected |
Required boolean: true or false. When true, components created in the organization that installs the package cannot link to or reference the label. |
shortDescription |
Required. A recognizable description that identifies the custom label and is used in merge fields. |
categories |
An optional comma-separated list, limited to 255 characters, used to filter custom-label list views. It does not determine the label's identity, text, or protection. |
Behavior and Constraints
protected establishes a package access boundary. A protected label supplied by an installed package cannot be referenced by components created in the installing organization. If subscriber-created components are expected to consume a package's label, that restriction matters independently of the label's language or value.
The label's master text and its translations are separate deployment content. Changing language or value in a label definition does not include the separate translation files in a deployment. A payload containing only the master bundle does not contain those additional-language definitions.
categories is an organizational aid for list-view filtering. It is not a substitute for selecting labels by their individual fullName values.
Deployment and Retrieval
Select the correct manifest identity
-
All labels: In
package.xml, useCustomLabelsas the type name and*as the member to retrieve all custom labels defined in the organization. -
Named labels: Use
CustomLabelas the type name and list each label'sfullNameas a member. For example,quoteManualandquoteAutowould be two separate members. -
Namespace restriction:
CustomLabelscannot be retrieved with a namespace. -
Translations: Retrieve
Translationsseparately when the required scope includes additional languages.
CustomLabels does not support retrieving individual labels by name. Putting a label name under the plural type does not replace the singular CustomLabel selection.
Include the master file and translation files
In Metadata API file format, master label values are stored in labels/CustomLabels.labels. Additional-language translations are stored under translations in files named localeCode.translation. The localeCode identifies the translation language; use a supported translation language code.
For a deployment that includes both master values and translations, include both sets of files and their corresponding manifest entries. In Salesforce DX source format, these files appear as CustomLabels.labels-meta.xml and localeCode.translation-meta.xml.
A translation file returned by a selective retrieval is not necessarily a complete language inventory. A January 2026 retrieval report describes receiving translations only for the named CustomLabel members requested alongside a Translations language.
Resolve consuming-code dependencies
An Apex deployment error containing External string does not exist can indicate that a referenced label is absent from both the target organization and the deployment payload. The individual label must already exist in the target or be created in the same deployment as the consuming class.
Including CustomLabels in the manifest alone does not establish that the required label definition is present in the payload. This dependency does not require labels to be deployed in a separate preliminary step.
Relationships
CustomLabel is the child definition contained in the bundle's labels array and the singular manifest identity used for named retrieval. ApexClass and ApexPage can consume individual labels through Apex and Visualforce references; those references are in the consuming code or markup, not fields on the label bundle.
Name-based translation association: Translations stores additional-language text in customLabels entries. Each entry's name identifies the individual label, matching its fullName, while label supplies the translated text. This association uses the label name, not the bundle name.
Reported Issues
-
Selective retrieval can return only part of a language's label translations. In a January 2026 report, requesting named
CustomLabelmembers together with a particularTranslationslanguage returned translations only for those selected labels. Treating that language file as a complete inventory would miss other label translations. Selective label and translation retrieval report. -
A missing label can block Apex deployment even when the manifest includes
CustomLabels. In a 2021 automated-deployment discussion, the explanation was that the referenced label had to exist in the target or be created in the same deployment as the class. The report does not establish a requirement for a separate labels-first deployment. Missing external string deployment discussion. -
An XML editor warning can be a local schema-validation issue rather than a Salesforce deployment failure. In a discussion opened in 2020, users saw
cvc-elt.1.a: Cannot find the declaration of element 'CustomLabels'. Replies in 2022 reported clearing that warning by changing the XML extension's schema-validation setting fromalwaystoneveroronValidSchema, while retaining other XML validation. This does not establish that the metadata itself is deployment-ready. XML schema-validation warning discussion. -
A commented translation value was associated with unexpected label language in a Lightning web component. In a 2019 report, a Japanese master label displayed English even though the reported language and locale were Japanese. The author reported correcting the display by replacing the commented text in the Japanese translation's
labelelement with an explicit value matching the master text. This is a conditional report, not a general requirement to duplicate every master value in a translation file. Unexpected translation display report. -
A label-related error can interrupt retrieval of other metadata. A 2024 report described
Missing fullName on CustomLabelagainst the localCustomLabels.labels-meta.xmlfile while retrieving newly added or overwritten components, even when labels were not the intended retrieval target. The discussion provides no confirmed cause or resolution. Missing fullName retrieval report.
Common Questions
How do I retrieve all custom labels?
Use CustomLabels with the wildcard member * in package.xml. Include Translations separately if you also need additional-language text.
Why can't I retrieve one label using CustomLabels?
The plural type does not support named label retrieval. Use CustomLabel and specify the individual label's fullName as the member.
Does deploying CustomLabels also deploy translations?
Not by itself. Master values are in CustomLabels.labels; additional-language definitions are separate Translations files that must be included in the deployment.
Do labels have to be deployed before Apex classes?
Not as a separate step. A referenced label must already exist in the target or be created in the same deployment as the consuming class. Check the actual label definitions in the payload, not just the manifest type entry.
Why can't subscriber-created code reference a packaged label?
Check the label's protected setting. When it is true, components created in the installing organization cannot link to or reference that label.