If you have state and country picklists enabled in your organization, you must configure internal setting.
In Salesforce, if state and country picklists are enabled, the state and country text fields are saved as Integration Value fields. An integration value is a customizable text value that is linked to a state or country code. When you update a code value on a record, that record's state or country text field is populated with the corresponding integration value. Similarly, when you update a state or country text field with a valid integration value, the corresponding state or country code field is updated.
In a state and country picklists-enabled organization, if the code or text value of a state or country is updated, the integration values on your records are not updated. Name values are not stored on records. So you must enable the
enableExtractCountryFromPicklist
to retrieve country names from Salesforce state or country code.
To dynamically retrieve the state and country names, set the value of the
enableExtractCountryFromPicklist
internal setting to true. Default is false.
The following sample code enables retrieval of state and country names from Salesforce state or country code: