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
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?

Thanks,
Yamini.
Sumeet_ForceSumeet_Force

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();