Populate a Custom Picklist with a Global Value Set

Sprint 1 in a Salesforce build is a few different things to a developer, it is the least complex in terms of effort (in most cases) but it can be the most time consuming depending on page layouts, record types and custom fields. I really enjoy sprint 1, as it builds the framework for the Org. Firstly themes and branding sets the Org aside from all other Greenfield Orgs, and then we get into Record Types, Page Layouts and Custom Fields.

Why I love Custom Picklists

Picklists are my favourite field to construct in Salesforce, for a couple of different reasons, but the main reason is that it removes the user error element from the completion. If the end user has a set list of values to choose from, its impossible to get it wrong. Also picklist values are available for reporting (text fields are not). There is a case for having a generic “other” option in the value set should the values not fit, and we can use a rule to police that (I will cover that in another post)

What is a Global Value Set?

When you create a custom picklist, it’s only available to the object you are working on. To share the values ​​with other objects, promote the picklist to a global value set. The original custom picklist references the global value set for its values, and the global value set is also available to other custom picklists. Sharing is caring after all.

Where this comes into play is if for example you are using the same picklist value set across multiple fields in your Org, the last thing you want to do is type the same values over and over again (particularly if there are a lot of them!) A good example of a standard Value set is Countries:

If we had to type this list out every time we wanted to use a picklist of countries, this would be incredibly time consuming and frustrating, so Salesforce give us this Value set as standard. The logic behind Global Value Sets is the same. Should you have a large set of values that you use across multiple objects in your Org, you can build a set to use repeatedly, saving huge time and effort!

How do we go about this?

One thing to note: Global value sets are always restricted. You can’t convert them to unrestricted. This protects your values, because changing global value set values modifies the values for all the fields that reference the global value set.

  • From Setup, enter Picklist in the Quick Find box, then select Picklist Value Sets.
  • Next to Global Value Sets, click New.
  • Enter a label for the global value set. This name identifies the set in Setup, and appears as Values option when users create a picklist field.
  • To tell users what these values are for, enter a specific description of the global value set. This text appears on the Picklist Value Sets list page in Setup.
  • Enter the values, one per line.
  • Optionally, choose to sort the values alphabetically or to use the first value in the list as the default value, or both.If you select both options, Salesforce alphabetizes the entries and then sets the first alphabetized value as the default.
  • Click Save.To move values or re-alphabetize them, use Reorder.

From here we are able to use these values in any picklist we create, as below:

Promote a picklist to a Global Value Set:

If we already have a Picklist built and we have just manually entered the values, and we realise that we will use these values across the Org, all is not lost! We can promote a Picklist to a Global Set at any time, but there are some considerations:

  • You can promote fields that have up to 1,000 values ​​(both active and inactive).
  • You can promote only restricted picklists. To promote an unrestricted picklist, convert it to a restricted picklist.
  • You cannot promote a field to an existing global value set.
  • Picklist values ​​translated using Translation workbench have a limit of 40 characters.
  • You can’t undo a custom picklist field’s association with a global value set. If you need a picklist field to use a different global value set or different individual values, delete the custom picklist field, and create a new one in its place.

If we want to do this, we can simply select the picklist we want to promote, as below:

Simply edit the field, and at the top beside “Change Field Type”, is “Promote to Global Value Set”

From here just name it, save it, and its available for all picklists. Again saving us time and making creation of fields less taxing. A simple yet incredibly useful trick from Salesforce.

We hope this helps, and thanks for reading,

The Tether Team.

#salesforce #tethertips #CRM

Share the Post: