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 we鈥檒l take a look. More often than not, we鈥檒l 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 we鈥檙e powerless to fix. A good example is the bug that causes Salesforce to raise the Duplicate picklist value specified:AG deployment error.

Why鈥檚 my standard picklist throwing a deployment error?

If you鈥檝e 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 here鈥檚 why you鈥檙e 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, you鈥檙e 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 that鈥檚 why you can鈥檛 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 we鈥檙e asking users who encounter the Duplicate picklist value specified:AG error to report it to Salesforce support. Here鈥檚 hoping the good folks at Salesforce can take a look at improving this one for us 馃檹

TDX

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, you鈥檒l find your deployments are more successful than ever. If you haven鈥檛 already, start your today.

Ready to get started with 91导航?