Tuesday, 30 July 2024

How do we retrieve picklist values from standard picklist fields?

 Hi ,

 When we have to retrieve picklist values from the standard Picklist Fields (eg: Stage on Opportunity object , Industry on Account object etc.,) then we have to use StandardValueSet. 

In API version 38.0 and later, standard picklists are represented by the StandardValueSet type. In previous versions, standard picklists are represented by the CustomField type. 

Note:

The names of standard value sets and picklist fields are case-sensitive.


Example: 

To retrieve picklist values from Opportunity's Stage field then we have to use StandardValueSet as shown below.

package.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>OpportunityStage</members>
<name>StandardValueSet</name>
</types>
<version>58.0</version>
</Package>

Output:




This following link has standard picklists as standard value sets and their corresponding field names.



Reference:


No comments:

Post a Comment

What’s the difference between Einstein Article Recommendations and Suggested Articles?

How Does Einstein Article Recommendations Work? Einstein Article Recommendations helps support agents resolve customer cases efficiently by ...