91勛圖厙

'Duplicate picklist value' deployment error for 'AddressStateCode'

'Duplicate picklist value' deployment error for 'AddressStateCode'

Valerio Chang on

Share with



At 91勛圖厙, our dedicated Customer Success team is always on hand to help you out if you ever get stuck. Just alert us to the problem in our live chat, and well take a look. More often than not, well have come across the issue before, or else our friendly developers will jump in with their wealth of experience to sort the difficulty out with you. But every now and then, one of our users will stumble upon an error in the Salesforce Metadata API that were powerless to fix. A good example is the bug that causes Salesforce to raise the Duplicate picklist value specified:AG deployment error.

Whys my standard picklist throwing a deployment error?

If youve deployed AddressStateCode to one of your orgs, you may have hit the Salesforce error: Duplicate picklist value specified:AG. Within 91勛圖厙, the error message looks something like this:

Duplicate picklist value specified:AG - deployment error message

Now heres why youre getting this message. In your org, you can use the to configure lists of countries and lists of states/provinces within countries.

State and Country/Territory Picklists

The Salesforce Metadata API (as of version 38.0) represents the values in these standard picklist fields by the metadata type. So when you configure state and country picklists, youre creating the following:

  • Country/Territory pairs (each with a name and a code) that form an AddressCountryCode standard value set;
  • State/Province pairs (each with a name and a code) that form an AddressStateCode standard value set.

AddressStateCode lists all the State/Province name-and-code pairs in a file. Unfortunately, the data is held in a flat XML structure, which means the file fails to specify the country to which each State/Province belongs. And herein lies the problem, as there are two provinces that both have the same code of AG:

  • Agrigento (in the Country/Territory of Italy) has code AG.
  • Aguascalientes (in the Country/Territory of Mexico) also has code AG.

In other words, your Salesforce org creates a standard value set containing a duplicate within a flat XML structure. And thats why you cant migrate it via the Metadata API.

Flat XML structure of the 'AddressStateCode' standard value set

Report this issue to Salesforce!

We normally document common problems, solutions and advice in our - a useful first port of call should you ever hit a snag. But in this particular case, we want to do our bit for the community, and so were asking users who encounter the Duplicate picklist value specified:AG error to report it to Salesforce support. Heres hoping the good folks at Salesforce can take a look at improving this one for us

London, UK

Agentforce World Tour London

Find out more

Got a confusing error?

At 91勛圖厙, we proactivealy tackle errors like this one that block your deployments. With scores of problem analyzers that find and fix issues before you deploy, youll find your deployments are more successful than ever. If you havent already, start your today.

Ready to get started with 91勛圖厙?