Loading

Reactivate the deactivated picklist values with Metadata API

Date de publication: Oct 13, 2022
Description

In certain circumstances an Org will have a very high number of inactive picklist values. The UI only shows a certain number of these values (1000), even if hundreds more exists within the metadata. What will happen in this situation is Admins will try to create a new value based on an existing value they cannot see. This will result in a Duplicate Value error message. This article will explain the basic process of how to reactivate these values using Metadata API.
Résolution
 
 
1. Copy the following XML and paste it in to your text editor:
<?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>

2. Replace the object within the <members> markup with the name of the Object you need to retrieve, i.e.Account, Case, etc.
3. Save the file as package.xml on your desktop (you can choose any name you like)
4. Using the package.xml, retrieve the metadata from your org: doc
5. Unzip the file to your desktop, being sure to retain folder structure.
6. Open the folder and go to Objects>(Object Name) and open the XML file for the Object
7. Within the XML file for the Object, use search to find the picklist field definition. It will look something like this:
<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>

8. Add an entry for each inactive value:
<picklistValues>
         <fullName>Inactive Value</fullName>
         <default>false</default>
</picklistValues>

9. Save the XML file and zip the upackaged folder into a new .zip file. Make sure you use a name you won't confuse with the original .zip file.
10. Go back and deploy the new zipped package using metadata api. doc
11. The package should deploy within a few minutes, and the inactive picklist will now show as active within the Org.
Numéro d’article de la base de connaissances

000382794

 
Chargement
Salesforce Help | Article