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 value from query results

Is it possible to create picklist value based on query results.

Maximum values returned can be 15.


example: providing citylist base on state selected. and only those city name where the shows are being scheduled.


It sure is. Try something like this:



public SelectOption[] results {get; set;} results = new List<SelectOption>(); for(sObject obj : [SELECT ...]) { results.add( new SelectOption((String)obj.get('Id'), (String)obj.get('Name'))); } }