Migrating Standard Picklists and Field Dependencies

Most Salesforce admins find themselves using Change Set for moving items from Sandbox to Production. Change Sets are the workhorse of Salesforce, reliable and they get the job done most of the time. But sometimes you need a more precise too. For example when you want to move field dependencies for standard picklist fields like Case Reason or Case Type.

The solution to this dilemma is XML packages. Before you say I’m an Admin and stop reading – hear me out.

XML stands for Extensible Markup Language and unlike many coding languages it is designed to be readable by humans. To be honest though, it is more like reading Homer than J.K. Rowling–not always the easiest to comprehend but it is still readable.

The good news is you don’t have to know much XML and I will walk you through all the steps to deploy dependent picklist values.

Let’s say we have a custom field called “Reason Detail” that is dependent field on the standard field Case “Reason”. In the Salesforce UI it will look like this:

Salesforce Field Dependencies

When we look at this same table in XML it looks like this:

If you look at the highlighted section you can easily see that the “Reason Detail” value “Product Defect” will only show under the case reason of Breakdown, Equipment Design, Installation and Performance. Pretty simple, right?

So to migrate this field dependency from one sandbox to another we just need to retrieve the XML and then deploy the XML to the new org.

I’ve summarized the steps to do this below–all you need is system admin permissions–but you can also find a step by step guide to retrieving and deploying using Workbench on this Salesforce help article: https://help.salesforce.com/s/articleView?id=000315117&type=1

Step 1: Prepare the XML file

The first step is to prepare the xml file with the list of metadata you want to pull from your sandbox. In our example we are only including the two field names we want to retrieve.

  1. Open Notepad or similar txt application
  2. Start by copying and pasting the below code snippet. In this example we are going to ask Salesforce to retrieve or return an XML of the metadata for the Case “Reason” picklists (they call this StandardValueSet) and the custom field details for “Reason Details” and how it relates to Case “Reason”.
  3. Feel free to swap out the custom field Reason_Details__c with the api name of your custom field.
  4. Give the file an name and save it as an .xml.
    • I called mine “Retrieve.xml” (Very important –it must end in .xml)

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
   <types>
     <members>CaseReason</members>
     <name>StandardValueSet</name>
   </types>

   <types>
     <members>Case.Reason</members>
          <members>Case.Reason_Details__c</members>
     <name>CustomField</name>
   </types>
        <version>53.0</version>
</Package>

Step 2: Get the fields and dependent picklists from your sandbox.

Now that we have the retrieve XML file prepared, the next step is to use Workbench to get the metadata for these fields from the sandbox.

  1. Go to https://workbench.developerforce.com/login.php
  2. Select “Sandbox” environment
    • Note: The API number listed is usually the most current so typically okay to leave as is unless your Production org is a release behind your Sandbox org. For example if Sandbox is on Summer ’23 and your Production org is still on Spring ’23. In that case lower it one number.
  3. Log in to workbench using your Sandbox credentials
  4. Go to “Migration” tab
  5. Select “Retrieve” option
  6. In the Unmanaged Manifest section click the “Browse” button and select the package XML file you created in step 1
  7. Click “Next” button
  8. Click “Retrieve” button
  9. Click “Download Zip File” and save the file
  10. Take note of where you saved it as you will use this zip file in Step 3
  11. Pro tip: Open the file with Notepad to review the file to ensure you pulled the correct information.

Step 3: Deploy the fields and dependent picklist to Production

The last step is to push the metadata you retrieved from the Sandbox into the new target org.

  1. Go to https://workbench.developerforce.com/login.php
  2. Select “Production” environment 
  3. Log in to workbench using your Production credentials
  4. Go to “Migration” tab
  5. Select “Deploy” option
  6. Click the “Choose File” option and select the zipped file you retrieved in Step 2.
  7. I recommend checking the following fields
    1. Rollback on Error
    2. Single Package
  8. Confirm all of the options for deployment.
  9. Click on the Deploy button when you are ready.
  10. Wait for the process to be completed. It usually doesn’t take too long.
  11. Confirm the results deploy successfully, if not check the file for any errors.

That’s it! Now you can log into the target org and view the updates you just made. You should now see the picklist values and field dependencies match the sandbox org.

Advertisement