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
anuragsinghnsanuragsinghns 

State & Country Picklists access in apex class

Hi Guys,
I need to access the State & Country Picklists values in my apex class any idea as to how this can be done I know it is available in API 31.0 onwards http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_addresssettings.htm

any help here will be really appreciated

Thanks
AshlekhAshlekh
Hi,

When you enable the State and Country Pcklist in your org then It means the Address field('Address' field contain address line 1, state ,country etc fields)  in your org now will show you state and country values in their respective field state and country fields in Address container. This is only apply on standard object address field because in custom object we can't create address field.

If you enable it then use Country field of address on VFP page (On contact object you can find Mailling Address and MailingCountry is the field of this address).
It will show you pciklist type on page.  

Now you have to apply  a describe call on MailingCountry  field and then get the value of picklist by picklist discribe call



IF it helps you than please mark it as a solution and ENJOY APEX.