Can Schema.DescribeFieldResult be used once to get values for multiple picklist fields or do i need to use that method multiple times for each picklist field.

I have a visualforce page where i want to dynamically pull picklist values of fields. I used Schema.DescribeFieldResult for one field.

Do i need to do this for each field? When i use inputselect

public static List<String> getPriorityPickListValues() {
    List<String> options = new List<String>();
    Schema.DescribeFieldResult fieldResult = Vendor__c.Type__c.getDescribe();
    List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
    for (Schema.PicklistEntry f: ple) {
  • I am a bit confused about your scenario. Do you want to add all the possible picklist values in multiple fields into one single string option list, or multiple option list?
    – Lance Shi
    Commented Oct 19, 2016 at 4:00
  • I have 4 picklist fields on an object with 10-12 values in each. I am using inputselectoption to display each individual field separately on a visualforce page. Am looking for the best way to dynamically populate those picklist values.
    – SfdcDev14
    Commented Oct 19, 2016 at 4:45
  • I have edited my answer according to this.
    – Lance Shi
    Commented Oct 19, 2016 at 4:50

2 Answers 2


Schema.DescribeFieldResult is just a type. It is not a method. And you can get a list of DescribeFieldResult values at one time. Below is the sample code:

    Map<String, Schema.SObjectType> global_describe = Schema.getGlobalDescribe();
    Map<String, Schema.SObjectField> object_fields_map = global_describe.get('Contact').getDescribe().fields.getMap();
    for(Schema.SObjectField sfield : object_fields_map.values()) {
        Schema.DescribeFieldResult dfield = sfield.getDescribe();

In the above code, only getGlobalDescribe() adds into governor limit.


Obviously you have a different scenario than what I understood.

So for your question: No, there is no Apex of doing them together. If your fields are also dynamic, you need to use a list of selectOption and use a for loop to retrieve them. But anyway, you need to retrieve the picklist options one by one.


As far as I know, that particular object is limited to one field. However, you could filter for multiple fields dynamically using getDescribe() on the sObject, e.g.:

List<String> fieldsToFind = new List<String>{'Picklist1__c', 'Picklist2__c'};
Map<String, sObjectField> fields = Schema.sObjectType.Custom__c.fields.getMap();
List<Schema.DescribeFieldResult> results = new List<Schema.DescribeFieldResult>();
for (String i : fieldsToFind)
  • I updated my question above, not sure if i can use maps for inputselect fields on VF page?
    – SfdcDev14
    Commented Oct 19, 2016 at 1:16
  • You can use a Map by using straight brackets, e.g. value="fields['Picklist1__c']", but I would assume you can't bind to the actual sObject instance since DescribeFieldResult refers to metadata information. That said, you could construct a Map<String, List<SelectOption>> of all the picklist values you need and reference them in the selectOptions component of different picklists with different map keys. Commented Oct 19, 2016 at 4:33

You must log in to answer this question.

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