Recently there was an interesting requirement in using State & Country picklist of Salesforce. Salesforce saves ISO code of State & Country picklist in Alpha-2 format however external system connecting to Salesforce needed Alpha-3 format.
There has been already an Idea on Idea Exchange created around 4 year back to support the Alpha-3 format however doesn’t seems much progress from Salesforce product team.
Anyways, there could be multiple way to handle this like, Maintaining Custom Setting , Custom metadata or Custom object for mapping between ISO Alpha-2 and Alpha 3 and use trigger to populate custom ISO field on Account or Contact.
While going through implementation guide of State & Country picklist, there was mention of Integration Value setting, which could be used to store the ISO Aplha-3 code. To see this option, navigate to “Setup | Data Management | State and Country/Territory Picklists | Configure States and Countries and Territories | country name | Edit” . Below image shows the setting
Impact of using Integration Value on State & Country picklist
On Standard page layouts, reports, list views and other places, we will still see country name, however at database (SOQL) level it would be stored as ISO alpha-3. That means, if you have Apex code written and trying to compare state or country with free text then it would not work. you would need to use ISO alpha-3 code.
Below short video shows before and after impact of using integration value in State & Country picklist.
Moving changes of State & Country picklist
We can use metadata API to move changes from one org to another org instead of changing these values manually everywhere.
Leave a Reply