Loading

Error 'Duplicate values' error on adding a picklist value to a field

Fecha de publicación: May 18, 2026
Descripción

A "Duplicate values" error can occur when adding a picklist value to a field in Salesforce, even when the value does not appear to exist. This typically happens when the value was previously deleted from the field or when it exists as an inactive value in a sandbox — a known issue documented in the article "Error 'Duplicate Values' for a new, unique picklist value" (see Additional Resources).
This article provides step-by-step instructions for Salesforce Administrators or Developers to resolve this error by reactivating the picklist value using the Salesforce Metadata API.

Solución
Warning! The following steps use the Metadata API which has the capability to make potentially destructive and irreversible changes to your organization if not used properly. Test thoroughly in a sandbox before implementing in production. Salesforce Support cannot be held responsible for issues arising from improper Metadata API usage.

Prerequisites

You will need access to one of the following Metadata deployment tools:

  • Salesforce Extensions for VS Code
  • Salesforce Migration Tool (ANT)
  • Workbench

You also need to know your affected picklist field's API name. See "How to find the API name of a field" in Additional Resources if unsure.

Step 1: Download the XML Retrieve Template

Download the XML retrieve manifest file matching your field type:

  • Standard picklist fields: Use "XML retrieve for standard picklists.xml"
  • Custom picklist fields: Use "XML retrieve for custom picklists.xml"
  • Global Value Sets: Use "XML retrieve for global value sets.xml"

To create your own, see Sample package.xml Manifest Files.

Step 2: Edit the XML Retrieve File

Open the downloaded XML file in a text editor (Notepad++ is recommended) and replace the placeholder values:

  • Standard picklist fields: Replace "EnterPicklistField'sAPINameHere" with your field's API name.
  • Custom picklist fields: Replace both the object API name placeholder and the field API name placeholder.
  • Global Value Sets: Replace "EnterGlobalValueSet'sAPINameHere" with the Global Value Set's API name.

Save the file (use Save, not Save As, to preserve the correct file extension).

Step 3: Retrieve Field Metadata via Workbench

  1. Log in to Workbench.
  2. Navigate to migration > Retrieve.
  3. Select your edited XML file, click Next, then Retrieve.
  4. If successful, a Download ZIP File link appears. Download and extract it.

Step 4: Locate and Edit the Metadata File

After extracting the ZIP, navigate to the appropriate folder:

  • Standard fields: standardValueSets folder — look for a file ending in .standardValueSet
  • Custom fields: objects folder — look for a file named after the object
  • Global Value Sets: globalValueSets folder — look for a file ending in .globalValueSet

Open the file in Notepad++ or a text editor.
Important: Only make the changes outlined below. Any other changes may cause unexpected or irreversible issues with your field's metadata.

Step 5: Add the Inactive Picklist Value to the XML

Locate the inactive picklist value and update its <isActive> tag to true. If the value is absent, add it using the appropriate XML template for your field type:
For standard picklist fields, add after <sorted>false</sorted> and before </StandardValueSet>:

<standardValue>
<fullName>Affected Picklist Value</fullName>
<default>false</default>
<isActive>true</isActive>
<label>Affected Picklist Value</label>
</standardValue>

For custom picklist fields, add inside <valueSetDefinition>:

<value>
<fullName>Affected Picklist Value</fullName>
<default>false</default>
<isActive>true</isActive>
<label>Affected Picklist Value</label>
</value>

Note on Special Characters: If your picklist value contains special characters, replace them with HTML character codes before adding to XML:

Special CharacterReplace With
&&
<<
>
""
''

For example, the value Aerospace & Defense must be written as Aerospace & Defense in the XML. Failure to encode special characters will produce parse errors such as: Error parsing file: The entity name must immediately follow the '&' in the entity reference.

Step 6: Redeploy via Workbench

    1. Re-zip the extracted folder (do not change the folder structure).
    2. In Workbench, go to migration > Deploy, select your ZIP file.
    3. First, deploy with Check Only and Rollback On Error selected. Click Next > Deploy.
    4. If the validation succeeds, repeat the deploy but deselect Check Only to complete the actual deployment.
    5. After a successful deploy, verify the picklist value is now active in Setup > [Object] > Fields > [Field Name].
Número del artículo de conocimiento

000382802

Archivos adjuntos

XML retrieve for global value sets.xml

0 KB

XML retrieve for standard picklists.xml

0 KB

XML retrieve for custom picklists.xml

0 KB

 
Cargando
Salesforce Help | Article