Imagine you have to store information about t-shirt sizes on multiple entities: Accounts, Users, Custom Objects, etc. And tomorrow, your company decides to switch to a different size format, for example using 48, 50, 52 instead of small, medium and large. You wouldn’t have any other option but to go to each and every field and update the picklist values there. And if you forget to update some of the field values, or if you have a typo like “Medim” instead of “Medium,” you will end up with broken reports and potentially other issues as well.
Global picklists will solve this problem for you and this feature is available right out of the box in the Winter ‘17 release. Let’s look at how you can create picklist value set and use it across multiple fields in your Salesforce instance today.
Creating a New Picklist Value Set
Say you want a picklist value set to store T-Shirt sizes and then use it on custom fields on Accounts and Contacts in your Salesforce instance. You can find the Picklist Value Sets section under Create in Classic UI, or under Objects and Fields in Lightning UI.
Simply click new and fill all of the required fields. On the example below you can see the global value set I created for T-Shirt sizes in my org.
Have you noticed something there? You can actually see the list of fields, where this particular picklist value set has been used. This makes it easy to keep track of all of the places where you used that value set.
Using Global Value Sets on Custom Fields
Now, after we create a picklist value set, we can use it when creating custom fields (both picklists and multi-select picklist field types are supported, it also works with dependent picklists) on the objects you like. The process of field creation didn’t change much, the main difference is in the screenshot below.
As you can see, you now have a chance to select if you want to use a global value set or specify values on a field level (as you used to do it before). Isn’t it simple?
Interacting with Global Picklists via Metadata API
With the Metadata API, you can interact with both global values sets and fields that are using it. The example below illustrates how global value sets are represented in the Metadata API.
Updated:This is a basic global value set. Territories North true South East West true
Please note, that Metadata API representation for global value sets was changed in API version 38.0. You might want to review the changes in the links in the resources section of this post.
When to use Global Value Sets
You should consider using global value sets for your picklist fields if:
- you need reusable picklist values on different fields and/or objects
- you will have 500 or fewer picklist values
Note: we’re considering increasing this limit in a future release.
When shouldn’t you use Global Value Sets
Some use cases where you won’t want to use Global Value Sets include:
- If you know that global value set will not be used by more than one field
- If you need to have more than 500 picklist values
- If you don’t want your fields validated when inserting via API
About the Author
Vladimir is a former engineer from the team that delivered Global Picklists. He has recently switched to product management and planning to use his deep technical expertise to make life easier for Salesforce admins and developers.
Also found at : Global Picklists: Define Globally, Use Locally