Activity Forums Salesforce® Discussions How to set default value in a picklist in apex code?

  • Abhinav

    Member
    August 17, 2016 at 1:35 pm

    Hi Pranav,

    public class sampleCon{
    public string strSelCountry {get; set;}
    public List<SelectOption> lstCountries {get; set;}

    public sampleCon(){
    strSelCountry = 'DELHI';
    }
    public List<SelectOption> getCountries() {
    List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption('DELHI','DELHI'));
    options.add(new SelectOption('NOIDA','NOIDA'));
    return options;
    }
    }

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos