function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AndrewTaylorAndrewTaylor 

Get Country ShortCode from API

Is there a way to access the configured Country and State picklists (Setup > Data Management > State and Country Picklists) via the API?
 
Best Answer chosen by AndrewTaylor
Rajiv Bhatt 16Rajiv Bhatt 16
The answer is available on this thread http://salesforce.stackexchange.com/questions/29177/get-address-information-from-metadata

Once country and state picklists is enabled in the org, you could simply access all the values from the picklist values of those picklist field from account or contact object. The link hast the example for getting it via apex, if you need the same info via REST API then uset the /services/data/v29.0/sobjects/Account/describe or /services/data/v29.0/sobjects/Contact/describe endpoints and parse the picklist values for the statecode or countrycode fields. 

Hope this helps.

All Answers

Rajiv Bhatt 16Rajiv Bhatt 16
The answer is available on this thread http://salesforce.stackexchange.com/questions/29177/get-address-information-from-metadata

Once country and state picklists is enabled in the org, you could simply access all the values from the picklist values of those picklist field from account or contact object. The link hast the example for getting it via apex, if you need the same info via REST API then uset the /services/data/v29.0/sobjects/Account/describe or /services/data/v29.0/sobjects/Contact/describe endpoints and parse the picklist values for the statecode or countrycode fields. 

Hope this helps.
This was selected as the best answer
AndrewTaylorAndrewTaylor
Thank you, this is exactly what I needed.
ips devips dev

Hi 

I am trying to submit form data through Curl

 

when submitting form geeting error in email

Salesforce could not create this lead because of the reason listed below. For more information about this error or help with Web-to-Lead, please contact Customer Support. 


Reason: There's a problem with this country, even though it may appear correct. Please select a country/territory from the list of valid countries. 

Lead Capture Page: Not available. 

 

please help