middleware – Query Salesforce to return picklist values (SOQL?)

If you are just trying to retrieve the values of a particular picklist field within APEX then you can use the following code. The blow snippet displays the Lead Source picklist field values in the debug logs within Salesforce. Using this pattern you should be able to retrieve the values you’re looking for and do what you need to with them. Hope this answers your question :).

List<String> pickListValuesList = new List<String>();
Schema.DescribeFieldResult fieldResult = Contact.LeadSource.getDescribe();
List<Schema.PicklistEntry> picklistValues = fieldResult.getPicklistValues();
    for( Schema.PicklistEntry pickListVal : picklistValues){
        string value = picklistVal.getValue();
        System.debug('value: '+value);

Read more here: Source link