[SalesForce] Are State and Country Picklist values enforced for data inserted through the API

We are going to be turning on State/Country picklists soon for Leads and Accounts.

There is currently a process for us in place that inserts new Leads using the SForce SOAP Api). Data that is currently entered through this process (by the very nature of the process) is not currently validated, and can end up with some weird values (for example, the following could all be entered in place of United States: USA, US of A, U.S.A., Untied States, United State of America, etc – this includes misspellings and weird variants).

When picklists are turned on, will data like this that will be entered for country or state cause issues/errors when we try to insert it through the API? If so, is there any alternative other than to catch these inconsistencies and correct them (per the approved list of Countries/States) before submitting them through the API?

Best Answer

The answer is YES - they will be enforced. This is easily proven by turning on the State and Country picklists in a Sandbox and using SFDC Workbench to insert 'bad' values (say, into the Account BillingCountry field)

You will receive a FIELD_INTEGRITY_EXCEPTION if you use a value other than the Integration Value configured for the country/state. Integration value is defined as:

A text value that corresponds to an ISO-standard state or country code. Salesforce provides default integration values, which you can edit to match values that you might be using elsewhere in your organization. For example, if you have a workflow rule that is using USA (instead of the default United States) as the country value, you can manually set the integration value to USA so that the workflow rule doesn't break when you enable state and country picklists. Setting integration values also lets external systems that might be interacting with your organization to continue to work.

The documentation doesn't indicate that you can use multiple integration values (which is what you want in your use case)

In a prior org, we had a similar situation with multiple values for the canonical United States. We had the source system update proxy fields on the Lead and then used workflows to deal with the variants. If nothing matched, it was assigned to an 'unknown' country and appropriate alerts were done