State and Country Picklists

Salesforce supports state and country picklists as part of address fields in standard objects. This feature improves data quality by storing standard names for each state and country. For instance, it ensures that all California addresses use the state code of “CA” instead of a mix of “CA”, “Calif.” or “California”. This feature is not enabled by default, but can be enabled by your system administrator. If enabled:

  • The “country” part of an address (e.g., a Contact’s Mailing address, or an Account’s Billing address) will be stored as a picklist instead of a plain text field. For example, the Contact’s Mailing Country will be represented by a field with API name MailingCountryCode, a picklist that contains the ISO standard two-letter code for the country of the address. The MailingCountry field will contain the full name of the country.
  • Similary, states and provinces will be represented by their ISO standard two-letter codes, stored in the StateCode field. For example, the Mailing State of a Contact will be stored in the picklist field with API name MailingStateCode. The MailingState field contains the full text name of the state or province. The State part of an address must conform to the country to which it belongs.
  • The full name of a Country, State or Province will be treated as its “integration value,” and will be text that uniquely indicates that State.

See the link to Salesforce for full details on how these picklists are set up.

Apsona automatically detects whether state and country picklists are enabled. In an org where they are enabled, Apsona displays the following behavior.

  • The Country name fields (e.g., the Contact’s Mailing Country field with API name MailingCountry) are rendered as picklists containing the “integration value”, i.e., the full name of the country as set up by the org’s administrator.
  • The State/Province name fields (e.g., the Contact’s Mailing State/Province field with API name MailingState) are rendered as picklists containing the “integration value”, i.e., the full name of the state or province, as set up by the org’s administrator.
  • The State Code and Country Code fields (e.g., MailingStateCode and MailingCountryCode) will not be editable through Apsona, but will be shown as read-only fields. Whenever the user edits a Country or State field, Salesforce automatically updates the corresponding Code field (as described in the Salesforce help page), so the data stays consistent.
  • If the user modifies a State field, that State must conform to the Country part of the address, e.g., the user cannot select a US state but specify Canada as the country. Such data errors will cause Salesforce to indicate a validation error, which Apsona shows as a popup message such as the one below.

Powered by BetterDocs