+ Start a Discussion
Yamini BathulaYamini Bathula 

access picklist field values using salesforce rest APIs

Hi Guys,

We have reuirement to get the picklist values in a custom field usinf APIs.

I have tried this

 /services/data/v41.0/tooling/query?q=Select+MetaData+From+FieldDefinition+where+EntityDefinition.DeveloperName='Lead'+AND+FieldDefinition.QualifiedApiName='customfield Name'

But this is giving me a massive response to parse.

Is there any other easier way to do this?


These 2 apex lines can do the thing for you:Execute them followed by your code to manage/process the picklist values:

Schema.DescribeFieldResult fieldResult = OfficeLocation__c.Country__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();