Print this page

State and Country picklist import errors and best practices

Knowledge Article Number 000220089
Description Importing new or performing updates to existing records may result in data validation errors when State and Country picklists (S&CP) are enabled if the address data contained in your file does not match the predefined state and country data.  For more details on how to get started, set, and configure state and country picklist values see the State and Country Picklists Overview documentation.

Users may encounter the following errors which are related to performing a data manipulation operation (an import, insert, update, or upsert) when state and country picklists are enabled:

The [BillingStateCode / ShippingStateCode] field contains [ShippingStateCodeHere], which isn't an available state. Your administrator can add it for you.

A country must be specified before specifying a state value for field

There's a problem with this state, even though it may appear correct. Please select a state from the list of valid states.: [Billing / Shipping] State/Province
 
There's a problem with this country, even though it may appear correct. Please select a country from the list of valid countries.: [Billing / Shipping] Country
 
Resolution Best practices and considerations to avoid receiving the above errors on import when using S&CP:
  • Set the default country to --None-- in your state and country picklist's setup section. This is not required but will help to ensure that a default country selection is not influencing the outcome of your data operation. See Configuring State and Country Picklists for more details on setting a default country.
  • Map both Standard State and Country fields together (BillingState, ShippingState & BillingCountry, ShippingCountry) OR both the StateCode and CountryCode fields together (BillingStateCode, ShippingStateCode & BillingCountryCode, ShippingCountryCode). For example, if you're mapping ShippingCountry it is recommended that you also map ShippingState and in contrast, if you're mapping ShippingCountryCode it's recommended that you map the ShippingStateCode field as well. An import which has standard fields (BillingCountry, ShippingCountry) mapped in conjunction with address code (ISO) fields (ShippingStateCode, BillingStateCode) may result in an error.
  • If using the Data Loader or other API tool and mapping to the standard address fields (BillingState, ShippingState & BillingCountry, ShippingCountry) you'll need to set the state and country picklist's integration values in your file. Integration values, by default, match the State/Country full names. For more details on state and country integration values see the Editing State and Country Details documentation.
  • If your file contains Country and State (ISO) Codes you will need to ensure you're mapping to the address code fields (BillingStateCode, ShippingStateCode & BillingCountryCode, ShippingCountryCode) in Salesforce.
  • For those Countries, were you have not defined any States, you can set update the State fields with an null value to clear them.
Causes and explanations for common errors:
 
The [BillingStateCode / ShippingStateCode] field contains [ShippingStateCodeHere], which isn't an available state. Your administrator can add it for you. 

This particular error may occur if mapping standard Country fields in conjunction with StateCode fields when the country set for a record or row in your file is not currently set as the Default Country within your State and Country picklist's setup.
 
Salesforce attempts to set CountryCode field values on records to the country set as the default country value in the State and Country picklist's setup. This behavior in conjunction with mapping only the standard Country address fields with State address code fields results in a mismatch between the StateCode value in your file and the default CountryCode values being set on the record if the file's StateCode isn't a valid value for the default country.
 
If you're mapping StateCode address fields and no default country is set or the country values in your import file do not match the default country in S&CP setup, you must include and map the CountryCode fields to effectively 'override' the application setting record's country fields to the default country.

A country must be specified before specifying a state value for field

This particular error is known to occur when no default country is selected in S&CPL setup and users map the standard country field and StateCode field.

There's a problem with this state, even though it may appear correct. Please select a state from the list of valid states.: [Billing / Shipping] State/Province OR There's a problem with this country, even though it may appear correct. Please select a country from the list of valid countries.: [Billing / Shipping] Country

This error is known to occur when mapping to standard State and Country fields (Billing/Shipping State & Billing/Shipping Country) and for records in your import file that do not have a correct or corresponding state or country value.  It may be incorrect due to the state not existing for the country specified or the values for either field not matching the Integration Value set in S&CPL's setup.

If the state value is confirmed as correct and the record does not share the default country selected in S&CPL setup, the error may occur when users have mapped State fields without mapping country fields.

Additional considerations and behaviors:
  • Mapping CountryCode with standard State field is successful
  • Mapping CountryCode with StateCode is successful
  • Mapping StateCode with standard Country fields fails if your file's State values country is not set as the default country.
  • Mapping the standard State field without the standard Country field fails if the state belongs to a country outside of the states listed in the default country set in S&CPL setup.

If integration values are the same as the ISO code values or differ from the State/Country full names it is a clear indication that they have been updated either through user interface via setup or potentially through the Metadata API prior to enabling the feature. Disabling and re-enabling the feature will not change the state/country integration values. Support does not have the ability to reset integration values back to default or track who and when changes were made to the state and country picklist's setup.


See Also:
Error: There's a problem with this country, even though it may appear correct. Please select a country from the list of valid countries.
Configure State and Country Picklists
How do I export Country values for State and Country picklists?
Import Wizard fails with generic error message




promote demote