Enabling State & Country as Picklists in Salesforce – Part 1

April 10, 2013 Matt Lamb

by Matt Lamb (@SFDCMatt)

If you’ve ever put address data into Salesforce, you’ve no doubt noticed that you’ve had to type out the State and Country of your addresses.And if you’ve followed the Salesforce Community for any time at all, you’ve probably noticed that the second most popular idea of all time on the IdeaExchange is to turn State and Country into Picklists. Well you’re in luck! As they do so well, Salesforce has listened to the feedback and has developed a feature to allow you to turn the standard State and Country fields in your org, on standard objects, into picklists.

Having recently gone through this process at one of our clients, we thought it prudent to share what we’ve learned so far. Enabling the feature actually takes four independent actions, of which this post will address the first:

  1. Enable and (optionally) configure the feature in your org
  2. Map all your existing data to the new standardized values
  3. Refactor existing customizations and integrations
  4. Activate the picklists

The first step is simple. This feature is in a generally available pilot for the Spring ’13 release, and can be enabled in your org by logging a case with Salesforce Support. Once the feature is enabled, you’ll see a new area of the Setup menu under Data Management where you can access the conversion features.

If you want to disable some of the states or countries, or have existing integrations that cannot be refactored to use the new standardized values, you’ll need to configure the lists of values to be contained in the two picklists. For the Spring ’13 release, this needs to be done with the Metadata API, and the easiest way to do so is by using workbench.developerforce.com.

Start by saving this package.xml file to your desktop. Go to workbench.developerforce.com and log in to the org (preferably a sandbox first!) you want to update. Once logged in, go to Migration menu and select Retrieve. Choose the package.xml file, select Single Package.

Click Next, and on the page that follows (not shown) click Retrieve to retrieve the configuration file from the Metadata API. When your retrieve is finished, download the .zip file to your desktop using the link shown below.

Within the .zip file you’ll find the package.xml, as well as a settings folder containing a file called Address.settings. This file contains the XML that defines the state and country picklists.

Open this file in a text editor on your local machine. You should see something that looks like this:

As of the Spring ’13 pilot release, custom states and countries cannot be added, and you cannot change the names (the Label tags in the xml) of the states and countries that are provided. The two things you can modify at this point are:

  1. If you do not want a particular state or country to show up in the picklist, you can set that one to false
  2. If you need to change the integration value of a particular entry, to comply with an existing integration with another system which cannot be refactored, you can set this value found in the tag.

As an example, if you did not want to show Andorra in your country picklist, and you had an external system that was expecting UAE to identify the country of United Arab Emirates, you would update your file as follows:

Again, if neither of things apply to you, you can skip this step entirely. When you are finished, save this file. Then select the setting folder along with the original package.xml (the same two files that were included in the retrieve), and save those to a .zip file. Go back to workbench, and this time choose Deploy from the Migration menu. Choose your .zip file, and select Single Package.

Click Next, and on the following page (not shown) click Deploy. When the deploy is finished you will receive a confirmation message, and this part of the process is finished.

The next step is to run a scan of your org to analyze your data and metadata for potential impacts. The option is available within the setup area for State and Country Picklists. After the scans are complete, you’ll receive an email with links to the results. Now you’re able to start the process of mapping your existing data to the new standardized values, which we’ll cover in the next post.

Previous Article
Enabling State & Country as Picklists in Salesforce – Part 2
Enabling State & Country as Picklists in Salesforce – Part 2

by Matt Lamb (@SFDCMatt) In Part 1 of this post, we outlined the process of enabling the new State and Coun...

Next Article
Getting to Know Flow: A Hidden Gem for Salesforce Admins
Getting to Know Flow: A Hidden Gem for Salesforce Admins

By Jeff Grosse (@CRMFYI), salesforce consultant I’m beginning to think that one of the least explored secti...