It seems like an out of the box feature, but as often, Salesforce gives you the freedom of choice how to work with the country fields on your objects – using them as free text fields or as standardized values in a dropdown.
Summed up, this configuration allows you to provide your users with a list of predefined states and countries to choose from. This is not only easier for your user, but will also heavily increase your data quality and simplifies all kinds of reports and forecasts: No more typos, alternate spellings or junk data.
Even your developers will like this, as they can map custom or other 3rd party integrations against standardized values, reducing the likelihood of errors.
Nice, but how will the change look like in my data afterwards?
Isn´t this fantastic? Follow the steps below to make it happen, and don’t worry: this setup is available for almost everybody. As of today, this functionality is available for all editions (except Database.com) and Salesforce Classic & Lightning Experience.
Where are the State and Countries used?
- Shipping address
- Billing address
- Mailing address
- List view filters
- Assignment rules
So this applies to leads, contacts, accounts, person accounts, quotes, service contracts, etc.
The setup, in general, is not complicated, but it takes time and it’s highly recommended to read the documentation before starting. If a full sandbox is available, consider going through the process there before working on your production to avoid causing trouble for your users.
Speaking of your users… don’t forget to inform them about the upcoming changes!
If your Org uses the standard address fields, Salesforce will help you a lot with scanning the Org and providing an overview of things to review. If you used custom fields to capture the countries, you will need some patience and additional time after the setup to align the date (highly recommended!).
- Go to Setup | Data Management | State and Country Picklists
Step 1: Start configuration
Configure state and countries: Select a default country & which countries will be available for the users to select from > 239 in total.
Active: Indicates accessibility of the field value to the Metadata API.
Visible: Indicates visibility to the user.
States are only pre-filled for the United States, Canada, Australia, Brazil, China, India, Ireland, Italy, and Mexico. States of other countries need to be added manually.
Step 2: Scan organization
The scan run by Salesforce shows where the standard state and country fields are used and which values require a mapping.
You can work as usual while the scan is running. It can take up to a few hours to finish.
Scanning won’t find formulas that include state and country metadata. It also won’t find personal list views and reports that use state and country metadata. Individual users must update those customizations themselves.
Converted leads will not be scanned. State and country values will not be updated on converted lead records when you enable state and country picklists.
At the end of the scan, you will receive two emails – one on address data and one on customization. After reviewing them, move on with step 3.
Step 3: Convert data
You are now asked to determine by which country the existing entry should be replaced, e.g. change from: Us > Change to: United States.
You can change up to 2.000 states or countries at a time (in a large Org an update via excel and data loader might be more efficient)
For the mapping, you may need some time and usage of excel. Oh, and be prepared to clarify with users which country exactly they meant by “Geramefs” or other nonsense entries.
After you click “finish”, the mapping is saved and cannot be undone.
Also check the customization report (sent via email) to see which Rules, ListViews, etc. are affected by the updates. Plan in some time to update all of them as soon as possible after the changes. This is especially important if you run process builder or workflows – they might not work until you update them.
If required, you can disable State and Country Picklist later, but you cannot go back to the original values if the record has been changed in the meantime.
Step 4: Click “Enable” and you are ready to go
All changes have been made and the functionality is fully operational
You just converted a standard text field into a clean picklist – well done!
Align with custom integration:
The states and countries are based on ISP-3166, which makes them generally compatible with other applications. If you still require to give them a different name, you can change them within the same setup settings.
Integration values for state and country picklists can also be configured through the Metadata API. Check the Metadata API Developer Guide for more information
Align Salesforce country list with HubSpot:
HubSpot uses single-line text fields as default. This might lead to frequent conflicts, as non-standardized values from HubSpot collide with the Salesforce values. Therefore, you need to change the field type in HubSpot to a dropdown select field type. Follow the link for a detailed description.
Disable State and Country Picklist:
If you disable state and country picklists:
- For records that you haven’t changed after enabling picklists, state and country values will revert to their original text values.
- For records that you have changed after enabling picklists, state and country integration values will stay.
- References to state and country picklists in customizations – such as process builder, workflow field updates, email templates, and Visualforce pages – will break.
- Columns and filters that refer to picklist fields in reports and list views will disappear.
The countries are provided in English per default and need to be translated by the Translation Workbench. A list for the import can be found here.
Use in Sandbox:
The setup of State & Country Pick-list cannot be deployed via a changeset from Sandbox to Production or vice versa. You need to use the Metadata API to move values between Sandbox and Production. To edit the existing states and countries in a picklist, configure your state and country picklists in your sandbox org. Then, use the Metadata API to retrieve the sandbox configurations, and deploy them to your production org. You can’t deploy new ISO codes or update ISO code values using any API.
Written by: Christoph Wiederle, Salesforce Consultant @ EMPAUA.