GlobalValueSet defines a shared set of values that custom picklist fields can use, including fields on different objects. It is not a field itself. A field references the shared set instead of storing its own local list of options.
Changes to the set affect the values inherited by every field that references it. This makes the distinction between a shared-set reference and a local picklist definition important during retrieval and deployment: retrieving a field can return the set's name without returning its values.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The inherited metadata component identifier. Creation appends __gvs to the developer name. CRUD-based calls must include that suffix when referencing the set. |
masterLabel |
Required. The set's display name, shown as Label in the user interface. It is separate from the component identifier. |
customValue |
The array of shared picklist values. At least one value is required. The set supports up to 1,000 values, counting active and inactive entries. |
customValue.fullName |
The identifier of an individual value, not the identifier of the containing set. |
customValue.label |
The value's display text. If omitted when creating a value, it defaults to the value's API name. |
customValue.default |
Required boolean. Controls whether the value is the default selection for the global set and the custom picklists sharing it. Defaults to true; explicitly set non-default entries to false. |
customValue.isActive |
Boolean controlling whether users can select the value. Defaults to true. Retrieval returns inactive entries as well as active entries. |
sorted |
Required boolean. true sorts the set alphabetically. Defaults to false. |
description |
The set's purpose and intended objects, up to 255 characters. This describes intended use, not actual field references. |
customValue.description |
The reason an individual value exists, up to 255 characters. |
customValue.color |
The hexadecimal color used for the value in report and dashboard charts, such as #FF6600. If omitted, a color is assigned dynamically when a chart is generated. |
Behavior and Constraints
Inactive values still count toward the 1,000-value limit. Deactivating entries does not recover capacity. A set must also retain at least one customValue.
Users can select only active values. However, a metadata retrieval returns both active and inactive entries. Finding a value in retrieved XML therefore does not establish that users can currently select it; check its isActive setting.
Default selection and active status are separate settings. customValue.default identifies the default selection, while customValue.isActive controls selectability. Because the required default flag defaults to true, non-default values should explicitly specify false.
The set's fullName identifies the component, while masterLabel supplies its UI label. Inside each customValue, fullName identifies that value and label supplies its display text. These identifiers and labels serve different purposes.
Set-level and value-level descriptions can record intent, but they do not establish which fields actually use the set. Actual usage is represented by field references through valueSetName.
Deployment and Retrieval
GlobalValueSet Metadata API components use the .globalValueSet suffix and reside in the globalValueSets folder. In package.xml, use the type name GlobalValueSet. The type supports the * wildcard in the manifest.
Deploying only newly added values is not an additive patch. If an existing value is missing from the deployed definition, Salesforce deactivates it. That change affects the picklists sharing the set. Include existing values that must remain active rather than sending only the new entries.
A CRUD update, meaning a direct create, read, update, or delete API operation rather than a file-based deployment, can deactivate a value in either of these ways:
- Update the containing
GlobalValueSetand omit the value. - Update the containing
GlobalValueSetwith that value'sisActiveset tofalse.
Direct CRUD updates to CustomValue are also supported, including setting isActive to false. These operations deactivate a value; they do not remove it from the set's capacity count.
CustomValue entries are retrieved and deployed with their containing GlobalValueSet in file-based operations. They are not independently deployable files. Do not treat each entry in the customValue array as a separate file-based component.
Creation automatically appends __gvs to the set's developer name. CRUD-based calls referencing GlobalValueSet must include that suffix in fullName. This requirement does not establish a universal rule for renaming local Salesforce CLI files; reported CLI name-matching behavior differs from the CRUD identity requirement.
To retrieve both a field's configuration and its shared options, include the CustomField and the referenced GlobalValueSet. A field containing valueSetName can legitimately have no inline valueSetDefinition; read the named set to obtain its values.
Also distinguish Metadata API files from Salesforce CLI source-format files. A reported CLI deployment failure involved supplying a .globalValueSet file where the command expected .globalValueSet-meta.xml. That file-format problem is separate from a mismatch involving the __gvs suffix.
Relationships
Incoming field references identify the picklists whose shared values are affected by a change. The reference belongs to a field's valueSet configuration, whether the field is retrieved separately or inside an object definition.
Referenced By
-
CustomField:valueSetName, inside the field'svalueSetconfiguration. -
CustomObject:valueSetName, inside contained field definitions. It is not a top-level object setting.
Name-based association: GlobalValueSetTranslation uses the component-name pattern <valueSetName>-<languageCode>. Resolve the complete value set name, including any namespace, followed by the dash and complete language-code suffix. This association points to the value set, not to an object. The naming pattern does not prove that a translation exists or require it to be deployed with the set.
Reported Issues
-
Missing inline options can mean the values are stored in a shared set, not that the field is empty. In a 2023 Python metadata-client report, field retrieval returned
valueSetNamewith no inlinevalueSetDefinition. The answer directed the caller to read the referencedGlobalValueSet. Shared-set retrieval discussion. -
A local-project warning did not mean deployment failed. A 2024 Salesforce CLI report described successful deployments with "returned from org, but not found in the local project" warnings. Returned component names included
__gvs, while retrieval produced unsuffixed local component names. This reported tooling mismatch is distinct from the CRUDfullNamerequirement and does not establish a universal file-renaming workaround. CLI component-name warning discussion. -
A "not found in zipped directory" error was attributed to the source filename, not the picklist values. In a 2022 CLI report, deployment used
Time_Zones.globalValueSet, while the source command expectedTime_Zones.globalValueSet-meta.xml. The answer identified the missing filename ending as the cause. Source-format filename discussion. -
A Tooling API 404 can require checking the record ID and host rather than changing the object name. In a 2018 report, answers confirmed the
GlobalValueSetobject endpoint and advised using the complete record ID, beginning with0Nt, and checking the host. A record ID is distinct from the developer name used to identify a set by name. Tooling API endpoint discussion. -
A normal Apex query was not the reported route for finding a global value set's ID. In a 2018 discussion, the accepted answer used a Tooling API query, and the question author reported success with a REST callout filtered by
DeveloperName. The answer distinguished that approach from a direct Apex query. Finding a set's ID discussion. -
Fetching options through an existing field can avoid a direct metadata lookup. In a 2022 Apex discussion, the accepted answer recommended calling
getDescribe()on a field using the set, thengetPicklistValues(). This retrieves entries through the field rather than locating the global set directly by name. Apex field-describe discussion.
Common Questions
Why does my retrieved picklist have valueSetName but no values?
The field references a shared global value set rather than an inline local list. Read the GlobalValueSet named by valueSetName to retrieve its entries.
Can I deploy only the new values in a GlobalValueSet?
That is not an additive update. Existing values omitted from the deployed definition are deactivated, affecting fields that share the set. Include existing values that must remain active.
Do inactive global picklist values count toward the limit?
Yes. The 1,000-value limit includes active and inactive values. Deactivation does not free capacity, and retrieval still returns inactive entries.
Do I need to add __gvs to my GlobalValueSet filename?
CRUD-based calls must include __gvs in the set's fullName. Do not turn that into a universal local-file rule: a reported CLI mismatch returned suffixed names from the org but retrieved unsuffixed local component names.
Can I deploy a CustomValue separately from its GlobalValueSet?
Not as an independent file-based component. File-based retrieval and deployment carry the entries inside the containing GlobalValueSet. Direct CRUD updates to CustomValue are supported.