What happened to the AccountSource picklist and what the dickens is a Standard Value Set?

Kevin Boyle on October 21st 2016


We’ve left sunny California and the freneticism of Dreamforce behind us for another year and returned to the delightfully stereotypical drizzle the UK is renowned for. I might have taken time to dwell on the fact that I live in a country where rain is the norm for six months of the year were it not for excitement of the Winter ‘17 release that is now upon us!

As with every Salesforce release, the team here at Gearset HQ jumped on the previews and partner pre-release documentation as soon as it was released back during the summer to make sure that the service was ready when the release was fully rolled out. As we’ve written about before on this blog, even with that planning this release has still been rockier for us than most. :(

One of the things I want to draw attention to specifically is the changing format of picklists. First, let’s define some terms so we’re all using the same lingo:

  1. Standard objects are objects that come as standard of the platform such as Account
  2. Standard fields are fields that are defined on standard objects by default, such as AccountSource

Let’s use a concrete example to look at what has happened. The AccountSource standard field on the Account standard object is a picklist field. In orgs prior to Winter ‘17, the values in the picklist are defined inline in the XML.


<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <fields>
        <fullName>AccountNumber</fullName>
    </fields>
    <fields>
        <fullName>AccountSource</fullName>
        <picklist>
            <picklistValues>
                <fullName>Web</fullName>
                <default>false</default>
            </picklistValues>
            <picklistValues>
                <fullName>Phone Inquiry</fullName>
                <default>false</default>
            </picklistValues>
            <picklistValues>
                <fullName>Partner Referral</fullName>
                <default>false</default>
            </picklistValues>
            <picklistValues>
                <fullName>Purchased List</fullName>
                <default>false</default>
            </picklistValues>
            <sorted>false</sorted>
        </picklist>
        <type>Picklist</type>
    </fields>
</CustomObject>

In Winter ‘17 the markup for the object has changed, and now it just looks like:


<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <fields>
        <fullName>AccountSource</fullName>
        <type>Picklist</type>
    </fields>
</CustomObject>

Where did all the values go? In Winter ‘17 the values have been upgraded to a first class piece of metadata known as a Standard Value Set that lives separately to the object. This is great in lots of ways and means it can be versioned and migrated separately to any changes that you might have on the object.


<StandardValueSet xmlns="http://soap.sforce.com/2006/04/metadata">
    <sorted>false</sorted>
    <standardValue>
        <fullName>Web</fullName>
        <default>false</default>
    </standardValue>
        <fullName>Phone Inquiry</fullName>
        <default>false</default>
    <standardValue>
        <fullName>Partner Referral</fullName>
        <default>false</default>
    </standardValue>
    <standardValue>
        <fullName>Purchased List</fullName>
        <default>false</default>
    </standardValue>
</StandardValueSet>

So how does the AccountSource field know to go and use a particular Standard Value Set? That's a good question with a bad answer - unfortunately everything is hard-coded with a set of magic values documented here: StandardValueSet Names and Standard Picklist Fields. Doubly annoying is some of the naming: the AccountSource standard field actually uses the LeadSource standard value set. So does the LeadSource standard field. Argh! These changes to the API have caused problems for many Salesforce developers. A quick search of the Salesforce Stack Exchange yields many questions from Ant users struggling with these changes, as their existing scripts no longer return the metadata they were expecting.

Rest assured that we are on top of this change and things will soon be back to normal in the app. In the meantime, you might see some unexpected behaviour:

  1. Gearset will try to render the picklist field, but it might appear empty in our difference list
  2. Any change monitoring jobs might show the picklist values as being deleted and the Standard Value Set as being created (as that is what has happened under the hood)
  3. We haven’t added dependency analysis for this new type yet so you will need to manually select it for deployment along with the field

Hopefully that provides with you some insight into what has happened with picklists in Winter ‘17 and why some things might not work quite like they did before. If you see any issues around this or indeed with anything in Gearset then please do ping us on the in-app chat or drop me an email ([email protected]).

If you've come here to find out how to migrate changes to Standard Value Sets then click here to get started with our free trial which supports this new metadata type.

Ready to get started with Gearset?

Sign up now to start your completely free 30 day trial
try it now