You need to sign in to do that
Don't have an account?
Prasunna
To get Picklist values from metadata
Could someone assist me in getting all picklist values (no matter what object it is but need all picklist fields and values) from metadata. As we have option to get all fields and objects using Entity definition and Field definition. But we don't have any option to get picklist values. Please let me know.
Thank you
Thank you
You can use the Schema class in Apex to dynamically retrieve picklist values for all objects and fields. Here is an example of how you can do this:
> Use the getGlobalDescribe() method to get a map of all objects in the org.
Iterate through the map and use the getDescribe() method to get the object describe result.
> Iterate through the fields of the object describe result and check if the field is of type "Picklist".
>If the field is a picklist, use the getPicklistValues() method to retrieve the picklist values.
Sample code:
Related: https://developer.salesforce.com/forums/?id=906F0000000D6l3IAC
https://salesforce.stackexchange.com/questions/387974/how-can-i-get-picklist-values-from-custom-metadata-type
https://www.jitendrazaa.com/blog/salesforce/get-picklist-values-in-apex/
If this information helps, please mark the answer as best. Thank you