Loading

Reactivate the deactivated picklist values with Metadata API

Data pubblicazione: Jun 7, 2026
Descrizione

In Salesforce, picklist fields can accumulate inactive (deactivated) values over time. The Setup UI only displays up to 1,000 picklist values, which means additional inactive values may exist in the metadata but remain invisible in the UI. When an admin attempts to create a new picklist value based on an existing inactive value they cannot see, a Duplicate Value error occurs.


This article explains how to reactivate deactivated picklist values using the Salesforce Metadata API without needing to create new values.

Risoluzione

Step 1: Create a Package.xml Retrieval File

Create a package.xml file in a text editor. The file should specify the API version and the object whose picklist values you want to retrieve. For example, to retrieve the Lead object, set the <members> element to Lead and the <name> element to CustomObject. Use API version 37.0 or later.
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
   <version>37.0</version>
<types>
       <members>Lead</members>
       <name>CustomObject</name>
   </types>
</Package>

Step 2: Retrieve the Object Metadata

Using the Metadata API file-based retrieve method, submit the package.xml to retrieve the object metadata from your org. Unzip the retrieved package, preserving the folder structure.
 

Step 3: Locate the Picklist Field Definition

Open the XML file for the relevant object (found under the objects folder). Search for the picklist field definition. The field entry contains <fullName>, <picklist>, and <picklistValues> elements. Each active value has a <fullName> and <default> element. Inactive values have the same structure but may include an <isActive>false</isActive> element.
 
<fields>
        <fullName>TestPicklistField</fullName>
        <picklist>
            <picklistValues>
                <fullName>Service</fullName>
                <default>false</default>
            </picklistValues>
            <picklistValues>
                <fullName>Sales</fullName>
                <default>false</default>
            </picklistValues>
            <picklistValues>
                <fullName>Marketing</fullName>
                <default>false</default>
            </picklistValues>
</fields>

Step 4: Add Entries for Each Inactive Value

For each inactive picklist value you want to reactivate, add or update its <picklistValues> entry so that it does NOT contain <isActive>false</isActive>. If the entry is missing entirely, add a new entry with the value's <fullName> and <default>false</default>.
 
<picklistValues>
         <fullName>Inactive Value</fullName>
         <default>false</default>
</picklistValues>

Step 5: Redeploy the Modified Package

Save the updated XML file, rezip the unpackaged folder into a new .zip file (with a different name than the original), and deploy it back to the org using the Metadata API deploy method. The inactive picklist values will now appear as active in the org.
Numero articolo Knowledge

000382794

 
Caricamento
Salesforce Help | Article