You need to sign in to do that
Don't have an account?

dependent behavior of Country and State picklist in Apex code
How to implement the dependent behavior of this new feature (i.e. enabling Country and State picklist in Org). On standard contact page it shows depent behavior automatically but when we bind these field with in VF page the dependent behavior is lost
Is there a simple way to implement this behavior in VF page
Any help would be appreciated
Is there a simple way to implement this behavior in VF page
Any help would be appreciated
If you wanna picklist list behaviour on Address field in visualforce page, then you need to use CountryCode and StateCode fields,
Referring Contact Mailing Address:
Referring Lead Address:
Referring Billing Account Address:
Hope you are clear..! Refer more at details about address field at
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/compound_fields_address.htm
Since counties/states codes are an ISO-3166 standard, you can implement your cusom select inputs based on that.
https://help.salesforce.com/HTViewHelpDoc?id=admin_state_country_picklists_standard_countries.htm&language=en_US
@Ankur your code will crash if you disable 'Country and State Picklist'
@ Akram, not sure what you are are trying to say but I figured out how to do it. These two links helped me
First I used describe call to check if MailingCountryCode/StateCode exists in Org, If exist the I used dynamic binding of object and Field
You need to do little modification of below links to make it work for you, Let me know if you want my modified code as well
http://salesforce.stackexchange.com/questions/48920/dynamic-picklists-of-objects-its-fields
http://forceschool.blogspot.in/2011/06/dynamic-binding-when-object-name-is.html
As per salesforce document, the below statement is mentioned,
StateCode and CountryCode are always available on compound address fields, whether or not state and country picklists are enabled in your organization.
However, it's not accessible if the state and country picklist options are disabled.
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/compound_fields_address.htm
Mark this as a solution if this helpful.