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

Picklist values from standard object



Basically, I want to created a picklist that lists of all SalesForce users (standard object User) in the New Opportunity form.   I went to Setup/Customize/Opportunities/Fields, and clicked New to created a new custom field name "UserList".  However, there is no option for me to select a User standard object as list values. 


Is there a way I can do this in Apex code or VisualForce?   I am new to this, if possible, please give me the steps.




Tryout the sample code given below :


             public List<SelectOption> getUserList()


             List<SelectOption> optionList = new List<SelectOption>();

             optionList.add(new SelectOption('','- None -'));     


             For (User u : [select name,id from User order by Name])


                optionList.add(new SelectOption(,;


              return optionList;    



            For more information go through the following documentation :




Hope this helps.


I will try it out, thank you.