It is a common requirement in Salesforce that records with address data need to store a country’s ISO value(s) onto a record. This can often be used for integration or reporting purposes. Vanilla Salesforce presents an issue here that there is only one country field, and generally, enforcing all users to just enter an ISO value isn’t practical.
You can enable this with AddressTools Premium, our 5* app for Salesforce which takes the worry out of bad address data by keeping all of your addresses validated, verified, corrected, and standardized. Like the sound of it? Try it for free on the AppExchange!
Anyway, let’s look into the details…
To solve this with AddressTools, ensure that you have your address block configured within the AddressTools Administration page. A guide can be found below showing how to do this. Along with this configuration, ensure that the Country Lookup is populated with a custom lookup field that references the packages’ Country object.

Assuming that the solution is configured with a basic setup which includes triggers being active for the object you’re working with, when you now upsert a record with a recognised country value in the configured country field, it will side-populate the newly configured lookup field with reference to the matching country record supplied with AddressTools. At this point, we have the luxury to enter the full name, ISO, or common alternate values into this field. With standardization enabled, it will convert it to the configured format.

Example of alternative country names that come with AddressTools to be standardized to your preferred format. Please note: more names can be added here.
But how can we now present these values on the record?
Since AddressTools has now populated the Country Lookup field, we can use some basic Salesforce techniques to get a formula field on the record displaying the ISO value(s). Navigate to Setup | Object Manager | [Object] | Fields & Relationships and then select New.
Select Formula field, continue and provide a Field Label, API Name and select Text. Once these options have been selected, press Next. Now we need to configure the formula field to make reference to the ISO-2 field found via the Country Lookup. Select Advanced Formula and then Insert Field to bring up a field finder. Drill into the current Object, then through the Country Lookup, and then select the ISO field you want to reference. In this example, we’ll choose ISO-2. Select Insert Field to confirm.

Press Next and make it visible for the profiles that you want to have access to the field and select Next once more. Optionally, add the field to your page layouts automatically and then Save.
Now we can manually adjust the page layout so that the field is displayed in a practical way. After that change has been made, now when we enter a record with a country value, all the data will then become available.

Formula fields can be used to fetch any data from the country object, including fields that you’ve created yourself.
Want to try it out for yourself?
Display a country’s full name, ISO-2 and/or ISO-3 value on a Record using AddressTools Premium for Salesforce. Try AddressTools Premium for free on the AppExchange today.
