0

I am trying to implement a retrieval of global picklist values in apex using metadata API but I am not able to understand how to do that. Anyone having any idea. I was looking at https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_globalpicklist.htm but was not able to understand. I am trying to send the UI(lightning component) the picklist values of country and state which are global picklists.

1 Answer 1

2

When retrieving Standard Picklists you need to use StandardValueSet in your xml package just like this:

<type> <member>CaseOrigin</member> <name>StandardValueSet</name> </type>

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_standardvalueset.htm

This is a list of standard picklists names: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/standardvalueset_names.htm If you are trying to retrieve custom picklist values just retrieve them as custom fields like this:

<types> <members>ObjectAPIName.PicklistAPIName</members> <name>CustomField</name> </types>

If you want to retrieve global picklists you need to use GlobalValue Set. If there is a field in your object that is referencing a global picklist with values then you need to retrieve the field along with the global picklist.

<types> <members>ObjectAPIName.PicklistAPIName</members> <name>CustomField</name> </types> <types> <members>GlobalPicklistAPIName</members> <name>GlobalValueSet</name> </types>

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_globalvalueset.htm

I hope this helps! If you still have issues, please post a sample of your package.xml file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .