One of our top feature requests is available in Spring ’13 as a beta release: state and country picklists. Said picklists let you pick a country or state from a pop-up list of options, rather than manually type the country or state into a text field. And anyone who has ever tried to run a report to capture all closed deals in the United States, er, Untied States, that is, U.S., I mean, US (etc.) knows how error-prone text fields are. State and country picklists allow for faster and easier data entry as well as cleaner data that can be analyzed more dependably.
Great, you say, sign me up.
You bet, we say. It’s not as easy as flipping a switch, though. You’ll need to do a little behind-the-scenes work to configure state and country picklists so that they work in your organization.
First, you’ll need to configure the picklists in the Metadata API, then you’ll scan your organization to see where text-based state and country data is used.
Next you’ll convert existing data and fix existing customizations so they work with the new, standardized values, and then, finally, you can enable the lists for your users.
The State and Country Picklists page in the Data Management area of Setup is your home base for preparing your organization to use the picklists. The process is outlined and most of the steps can be executed right there. You can also click Help for this Page to get complete documentation for the feature.
The most opaque step for administrators is probably the first one—configuring the picklists in the Metadata API. Using the Force.com IDE, you’ll need to edit the AddressSettings metadata component, which is new in Metadata API 27.0. AddressSettings allows you to control (1) what picklist values appear in the Salesforce UI and (2) how to map existing, text-based state and country values to new picklist values, so you can convert those old values to new values using the address conversion tool in Setup. The AddressSettings component has four fields for each state and country you enable, and it will look something like this abbreviated example when you’ve configured them:
<?xml version="1.0" encoding="UTF-8"?> <AddressSettings xmlns="http://soap.sforce.com/2006/04/metadata"> <countriesAndStates> <countries> <active>true</active> <integrationValue>United States</integrationValue> <isoCode>US</isoCode> <label>United States</label> <states> <active>true</active> <integrationValue>Alaska</integrationValue> <isoCode>AK</isoCode> <label>Alaska</label> </states> </countries> <countries> <active>true</active> <integrationValue>Canada</integrationValue> <isoCode>CA</isoCode> <label>Canada</label> <states> <active>true</active> <integrationValue>Alberta</integrationValue> <isoCode>AB</isoCode> <label>Alberta</label> </states> </countries> </countriesAndStates> </AddressSettings>
For more information on state and country picklists, including the limitations of the beta release, see the Spring ’13 Release Notes or State and Country Picklists—Beta on the Salesforce Help and Training portal. For information on using the Metadata API, see the Metadata API Developer’s Guide, and for information on the AddressSettings component, specifically, see AddressSettings. To give us feedback on state and country picklists, go to IdeaExchange.