Loading

Retrieve Account.AccountSource Picklist Values with Metadata API

Publiseringsdato: May 22, 2026
Beskrivelse

When using the Salesforce Metadata API to retrieve Account.AccountSource picklist values, a package.xml file that specifies the CustomField member type returns an Account.object file without any picklist values. This is a known behavior because standard picklist values are not stored directly on the field definition in the Metadata API.

Example package.xml that returns no picklist values:

<?xml version="1.0" encoding="UTF-8"?> 
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> 
<types> 
<members>Account.AccountSource</members> 
<name>CustomField</name> 
</types> 
<version>38.0</version> 
</Package>

Returned Account.object file:

<?xml version="1.0" encoding="UTF-8"?> 
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"> 
<fields> 
<fullName>AccountSource</fullName> 
<trackFeedHistory>false</trackFeedHistory> 
<type>Picklist</type> 
</fields> 
</CustomObject>

Why This Happens

Starting with Metadata API version 38.0, standard picklist values are managed separately through the StandardValueSet Metadata type — not through CustomField. Account.AccountSource shares its picklist values with LeadSource, which is the StandardValueSet name to use.

Løsning

This article explains how to retrieve Account.AccountSource picklist values using the Salesforce Metadata API by using the StandardValueSet Metadata type instead of CustomField.

Solution

To retrieve Account.AccountSource picklist values, add a StandardValueSet member to your package.xml. Use LeadSource as the member name, because Account.AccountSource shares its picklist values with the LeadSource StandardValueSet.

Updated package.xml — include both CustomField and StandardValueSet entries:

<?xml version="1.0" encoding="UTF-8"?> 
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> 
<types> 
<members>Account.AccountSource</members> 
<name>CustomField</name> 
</types> 
<types> 
<members>LeadSource</members> 
<name>StandardValueSet</name> 
</types> 
<version>38.0</version> 
</Package>


What Gets Retrieved

[1] LeadSource.standardValueSet: 
 
<?xml version="1.0" encoding="UTF-8"?> 
<StandardValueSet xmlns="http://soap.sforce.com/2006/04/metadata"> 
<sorted>false</sorted> 
<standardValue> 
<fullName>Web</fullName> 
<default>false</default> 
</standardValue> 
<standardValue> 
<fullName>Phone Inquiry</fullName> 
<default>false</default> 
</standardValue> 
<standardValue> 
<fullName>Partner Referral</fullName> 
<default>false</default> 
</standardValue> 
<standardValue> 
<fullName>Purchased List</fullName> 
<default>false</default> 
</standardValue> 
<standardValue> 
<fullName>Other</fullName> 
<default>false</default> 
</standardValue> 
</StandardValueSet>

[2] Account.object: 
 
<?xml version="1.0" encoding="UTF-8"?> 
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"> 
<fields> 
<fullName>AccountSource</fullName> 
<trackFeedHistory>false</trackFeedHistory> 
<type>Picklist</type> 
</fields> 
</CustomObject>


The valid StandardValueSet names can be found at here.

Knowledge-artikkelnummer

000383067

 
Laster
Salesforce Help | Article