You need to sign in to do that
Don't have an account?
return picklist using REST API
Hi,
How do I return a picklist of values from an Entity via REST API call?
Here is how I do this in Apex code:
Caller code:
xxxxHelper.getSelectOptions(Account.Question1__pc.getDescribe());
Called code:
public static List<SelectOption> getSelectOptions(Schema.DescribeFieldResult fieldResult) {
List<SelectOption> options = new List<SelectOption>();
for (Schema.PickListEntry ple : fieldResult.getPickListValues()) {
options.add(new SelectOption(ple.getLabel(), ple.getValue()));
}
return options;
}
I do see an equivalent /Account/describe but I am not sure how to map it into the call above to get the PickList values ?
TIA,
Vijay
The describe result has a collection of fields. Find the field you want in that collection, then see if there's a "picklistValues" collection under that.