+ Start a Discussion
Abhilash Mishra 13Abhilash Mishra 13 

Create Country State Dependent Picklist In apex code

Hello, I need to create a country state dependent picklist in my visualforce page.
I want to Default State and Country/Territory Picklists. I am able to get values of both country and state as suggested here.
But they Are not dependent Enough.
How to make them Dependent.? or should i my own object.
 
Best Answer chosen by Abhilash Mishra 13
Abhilash Mishra 13Abhilash Mishra 13
Hi finally i was able to it by using , user fields. implmenting user.countrycode and user.statecode
how ever you have to use additonal JS as the value stored will be name of countries and states. not the codes. 

All Answers

Abhilash Mishra 13Abhilash Mishra 13
I am able to get values of both country and state as suggested here.
https://help.salesforce.com/apex/HTViewSolution?id=000212327&language=en_US
Abhilash Mishra 13Abhilash Mishra 13
Hi finally i was able to it by using , user fields. implmenting user.countrycode and user.statecode
how ever you have to use additonal JS as the value stored will be name of countries and states. not the codes. 
This was selected as the best answer