I hv a vf page where i need to populate default value as ' United States' on [page load and also geography field should get all the regions related to United States.

Below is my controller method.

Controller -

public List<SelectOption> getDept()
        Schema.DescribeFieldResult departfield =  Geography__c.Country__c.getDescribe();
        List<Schema.PicklistEntry> picklist = departfield.getPicklistValues();
        for( Schema.PicklistEntry f : picklist){      
        options.add(new SelectOption(f.getLabel(), f.getValue()));

        return options;



  • so 1) what isn't working? and 2) can you reduce the size of the code to only the relevant bits
    – cropredy
    Oct 1, 2015 at 17:58
  • Hi Crop.. I hv done it.. Oct 1, 2015 at 18:01

2 Answers 2


The getter/setter for the selected value needs to be initialized to the default value in your controller. I believe this has been answered here Visualforce-selectlist-with-default-controller-setup


Just use isDefaultValue.

public String defaultValue { get; set; }

public List<SelectOption> getDept()
    // get your picklist entries
    for(Schema.PicklistEntry f : picklist){
        // perform existing logic
        if (f.isDefaultValue()) defaultValue = f.getValue();

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .