Country/State Codes

Last published at: 2023-01-05 08:14:27 UTC


Delete

The Country/State Codes setting has a different use depending on whether you have Country/State Picklists enabled in your Salesforce org or not. You can either map RV country and state codes with those as registered in Salesforce, or you can define your own country and state labels.


Orgs with Country/State picklists enabled:


In Salesforce orgs that have the Country/State picklists enabled, country and state codes are defined in the Salesforce setup. However, the state (province, prefecture, etc) codes in particular do not always match those provided by Record Validation. The Country/State Codes setting lets you override the country and state codes as provided by Record Validation, so that they will match the codes as defined in the Salesforce setup.

Country and State picklists let users select countries and states from predefined, standardized lists, instead of entering country and state data into text fields. The picklists protect data integrity by preventing typos, alternate spellings, etc.

Record Validation checks whether an address is valid by matching it with its own data. When an address is entered using the country and state data as provided by Salesforce in the country/state picklist, and RV has a different code in its record for that country or state, it will not be considered valid. By mapping the RV codes to the Salesforce codes in the Country/State Codes setting, the address will be validated even when the country or state codes differ from one another.

Country codes

The country codes as provided by Record Validation will almost always match those of Salesforce, as for 239 countries and territories they both use the same ISO2 country code format. The option to override an RV country code is present, but you will most likely not need it. Notable exceptions are the codes for the following countries and territories:

  • American Samoa (AS)               
  • Guam (GU)             
  • Hong Kong (HK)            
  • Marshall Islands (MH)              
  • Netherlands Antilles (AN)      
  • Northern Mariana Islands (MP)       
  • Serbia and Montenegro (CS)       
  • United States Minor Outlying Islands (UM)

These need to be added manually in Salesforce, and therefore might differ from the codes used by Record Validation.

State codes

Salesforce provides state or province codes for nine countries. These state codes do not always match those used by Record Validation, as the codes provided by RV and Salesforce can be the internationally used ISO2 codes, or alternative codes as used by the countries nationally. For countries other than these nine, you have to enter state codes manually in the Salesforce setup, leading to an even greater chance of discrepancy with what RV provides. This is where the Country/State Codes setting comes into play.

Country and state labels

In a State/Country picklist environment, the country and state labels can only be overridden in the Salesforce Setup. The country and state label overrides that you can set in the RV Setup are only intended for (custom) address field sets that do not make use of picklists.


Orgs that do not use Country/State picklists:


The country and state labels (names) as provided by Record Validation might not be exactly how you'd want them to be. For example, the English name might be used where you'd want the name in the local language, or RV might have an old name on record. By overriding the country or state label in the Country/State Code setting, you can use the labels as you want them to be.


Overriding codes and labels

Delete

Apex class

For the country/state overrides to work correctly, apex class 

rv2ControllerCountryStateCodes 

is needed.


Delete

For country codes, only edit the code override if you know that the current country codes do not match.

Adding a country or state override

  1. In RV Setup, go to Country/State Codes on the left.
  2. At top right, click Add Country.

  1. Select the country you want to add a country or state override for, and click Add.

  1. Click + Add Country Override or + Add State Override.

Per country block you can add one Country Override, and multiple State Overrides.

Adding a code override 

  1. In the RV Country Code or State Code field, enter the code as it is provided by Record Validation
  2. In the Country Code Override or State Code Override field, enter the code as it is set in Salesforce setup
  3. Click Save

In the example above, the state code as provided by Record Validation is 'GE'. The state code set in the State/Country Picklist settings in Salesforce setup is 'GLD'. With this setting, whenever state code 'GLD' is entered in an address, Record Validation will now consider it valid, even though it has listed 'GE' in its own data for this state.

Delete

You always have to enter the RV country or state code. Then you can either enter a code override, a label override, or both.

Adding a label override

  1. In the RV Country Code or State Code field, enter the code as it is provided by Record Validation
  2. In the Country Label Override or State Label Override field, enter the label you want to use instead of the label that is provided by RV
  3. Click Save

In the example above, the state code as provided by Record Validation is 'ZH'. The label for this code, as provided by RV, is 'South Holland', in English. The desired state label is the local translation 'Zuid-Holland', so this is entered in the State Label Override field. With this setting, whenever an address located in the province of South Holland is entered, the province name 'Zuid-Holland' will be shown instead.

Delete

You always have to enter the RV country or state code. Then you can either enter a code override, a label override, or both.

Deleting an entry

Delete an entry, either a single override row or an entire country block, with the applicable Delete
 button at the right of the row or block.