Loading

Export Country Values for 'State and Country' or 'Territory' picklists

Data pubblicazione: Aug 20, 2024
Descrizione
'State and Country' and 'Territory' picklist values are considered metadata. Because of this, they cannot be accessed via Data Loader or Reports, both of which only work with data in your organization. 

As a workaround you may use Force.com IDE to retrieve the metadata or follow the steps below.
 
Risoluzione

To retrieve the metadata of the State and Country picklist values to list Country values, follow the steps below:

1. Navigate to:

  • Classic: Setup | Data Management | State and Country/Territory Picklists

  • Lighting: gear icon | Setup | Data | State and Country/Territory Picklists


2. Click Configure states and countries. 

3. In the configuration page:

  • Classic: right-click on the page where the countries are listed and select 'View Page Source'.

  • Lighting: right-click on the page where the countries are listed and select 'View Frame Source.'

 

If you scroll down in the resulting source code you will see the XML Country output that you will want to copy.  You should see the country codes similar to the following:


<option value="AF">Afghanistan</option>
<option value="AX">Aland Islands</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
<option value="AG">Antigua and Barbuda</option>
<option value="AR">Argentina</option>
<option value="AM">Armenia</option>
<option value="AW">Aruba</option>
<option value="AU" selected="selected">Australia</option>
<option value="AT">Austria</option>
<option value="AZ">Azerbaijan</option>
<option value="BS">Bahamas</option>
<option value="BH">Bahrain</option>

Copy and Paste the results into your preferred spreadsheet program such as Excel or Google Sheet, where you can format them to the desired results.  It is not possible to obtain the State values.  Please see the Idea listed below.
Risorse aggiuntive

Vote, comment, and view a workaround with Visual Studio in the Salesforce IdeaExchange on implementing State & Country Picklists - Ability to export State and Country

Visit the Trailblazer Community here for some alternate options with the APIs.

Numero articolo Knowledge

000386707

 
Caricamento
Salesforce Help | Article