Deploying Salesforce State and Country/Territory Picklists
can be tricky, as not only do you need to find your picklist values, you also need to find their configuration settings.
Metadata comparison filter
To retrieve the picklist values, you need to select the Standard value set
metadata type (items AddressCountryCode
and AddressStateCode
), and to get the configuration settings, you would need to also include Settings
metadata type (item Address
).
So your selection would look like this for Standard value set
:
And this for Settings
:
Comparison results
Once the comparison loads, you'll be able to find the picklist values in Standard value sets
and the configuration settings in the Address Settings
item:
In this example below, I am deploying new Standard value set
metadata type (items AddressCountryCode
and AddressStateCode
), and the configuration settings are same hence not selected, otherwise you would need to also include Settings
metadata type (item Address
).
Limitations with deploying 'State and Country/Territory Picklists'
As per this Salesforce documentation, there are some limitations within the API as to what you're able to deploy. To quote Salesforce:
"You can use the Metadata API to edit existing states, countries, and territories in state and country/territory picklists. You can’t use the Metadata API to create or delete new states, countries, or territories.
To edit the existing states and countries in a picklist, configure your state and country/territory 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."