Table of Contents
Now and then, specific fields in your org may have values that are limited to a specified set.
For example, a cafe has a Product, Coffee. Instead of the customer guessing what coffee is available, they could select the kind of coffee they need from a list of available coffee. The picklist field, Coffee, could include values such as Cappuccino, Latte, Americano, Espresso, etc.
Simply put, a picklist field holds a predefined list of values for the Users to choose from. This results in a better, more structured way for data to be inputted into your org.
Structure of a Picklist
A picklist comprises two parts:
- Field: This defines the picklist type and whether it can hold just one or multiple values.
- Value Set: Comprises the values the picklist field can hold, their order, default value, and so on.
Types of Picklists
Picklist comes in three flavors:
- Custom Multi-Select
1. Standard Picklists
Standard picklists are available by default in your Salesforce org before any configuration or customization.
Example: Account objects have the standard picklist field, Account Source. Lead objects have the standard picklist field, Lead Status.
2. Custom Picklists
The problem mentioned in the note above can be fixed with the help of Custom Picklists. These are picklists created by us. We can add unique values and configure the properties of the picklist based on our requirements.
Let’s create a custom picklist field, Coffee, for a café!
1. From Setup, open Object Manager, and select the Object, Product.
2. Open Fields & relationships, and then click New.
3. For Field Type, select Picklist.
4. Click Next.
5. For Field Label, enter Coffee.
6. C Enter values, with each value separated by a new line.
7. Enter the values :
- Iced Coffee
8. Click Next, Next, and Save.
3. Custom Multi-Select Picklists
Custom Multi-Select Picklists fields enable users to select more than one value for a picklist field. When the User selects more than one value for the picklist, the selected values are shown in the field, separated by a semicolon.
The process of creating a multi-select picklist field is just like that of a custom picklist field. Remember to select, Picklist (Multi-Select) for the field type, though.
Picklists can take on the following properties:
- Restricted Picklists
- Dependent Picklists
1. Restricted Picklists
Restricted Picklists block users from adding new values to a picklist field through the API or other apps. This property is beneficial in keeping your picklist data clean.
Example: The barista at the café can enter values into the custom picklist field, Coffee, through an app. They enter a typo onto the list, and instead of Caramel Latte, they enter Carameal Latte.
We can avoid this situation by selecting the checkbox for, Restrict picklist to the values defined in the value set when creating a picklist field. When this option is not selected, a User cannot enter a new value through the API. However, they can enter a new value for the picklist either via the API or other apps.
Let’s change this setting on an existing picklist field:
1. Navigate to a picklist detail page and then click Edit.
2. Choose Restrict picklist to the values defined in the value set.
3. Click Save.
2. Dependent Picklists
A dependent picklist filters values for a picklist based on another picklist or a checkbox field in the same record. The picklist or checkbox that the dependent picklist value is based on is called the controlling field.
The advantages include the following:
- Acts as a guide for Users
- Saves UI space
- Improves data integrity
Example: To cater to the dietary restriction of their customers, the café offers vegan coffee options. We can create a controlling picklist field, Restrictions, that filters the picklist field, Coffee, based on the value of the field, Restrictions.
We’ll be creating a dependent picklist soon!
Managing Picklist Values
It’s imperative to ensure proper and consistent picklist values. Good picklist value management saves us time and ensures that the data in our org stays clean and consistent.
Where Do We Set Picklist Values
The value set for a particular Object’s picklist fields can be found on the Object’s Fields & Relationships page. Navigate to the Fields & Relationships page of the Object, Product, to find the custom picklist field, Coffee, we created before.
You may have noticed the column, Indexed in the above image. What does it mean? → An indexed field is stored in the database in such a way that it supports quick retrieval. This results in optimized list views, report generations, and other requests from time to time. This isn’t relevant now, but it’s always good to know a new fact! Occasionally, Salesforce assigns a field as indexed depending on performance analysis.
Manage Picklists Values
Let’s get hands-on and toy with the values for the picklist field, Coffee. Assuming you’re already on the Fields & Relationships page of the Object, Product, let’s get started!
- Click the picklist field, Coffee, to view the field’s detail page.
- Scroll down to see the value set for the field in the Values related list.
We have a couple of options available on the list. Let’s get to know how they work:
- New: This lets us add a new value to the picklist’s value set.
- Reorder: Let us rearrange the existing values.
- Replace: Enables us to replace an existing value. We can replace a current value with either a new value or another value in the set, or a blank value. When we replace a value with a blank value, the existing records stop displaying the value.
- Printable View: This lets us view all our values at once.
- Chart Colors: This option enables us to change the appearance of values on reports and charts.
Active, Inactive, Delated, and Replaced Values
You may have noticed that the Values related list has options to edit, delete, or deactivate individual values.
If you deactivate a value, you can find it in the Inactive Values related list. Although a deactivated value cannot be found on the picklist as an option, they’re not entirely removed from the org. You may wonder why?
For example, Pumpkin Spice Latte is quite the rage in fall, but they aren’t popular in summer. So, we can deactivate Pumpkin Spice Latte’s value during summer and activate the value during fall!
So, when should we delete a value? Sometimes we may not need a value anymore. The coffee, Mint Latte, failed miserably and is not on the menu anymore. Click delete, and you’re all set.
Edit Picklist Values
Let’s get back to the Values related list of the picklist field, Coffee, and edit a picklist value!
- Click Edit next to the value of your choice.
- Feel free to make changes to any of the following properties:
- Label: Edit the label to change the name of this picklist value wherever it appears in the UI.
- API Name: Ideally, this value shouldn’t change. If you change this value, the references to this value can break.
- Default: Check this box to set this value as the default value for this picklist.
- Chart Color: Here, you can choose how this value appears in reports and dashboards. If you don’t, the color is assigned dynamically.
Significance of a Picklist Value’s API Name
Why is the API name everywhere? It’s easy to miss this field, especially since it is auto-populated.
The API name is the unique identifier for the value. Even if the Label changes, it remains the same. Why does this matter?
The API name is how you reference a picklist value in a formula. It is the unique identifier for the picklist value. Imagine writing a long formula, but someone changes the Label of the value (the Label is what appears in the UI). However, the formula field is still valid and works perfectly fine since the API name never changed. See why the API name is essential!
Controlling Fields, Dependent Picklists, and Narrowing Values
We talked about controlling fields. Let’s create one now!
1. Open the Fields & Relationships page of the Object, Product.
2. Create a custom picklist field, Restrictions, with the values: Vegan, Lactose-Free.
3. Navigate back to the Fields & Relationship page of the Object, Product.
4. Click Field Dependencies.
5. Click New.
6. Select the following from the drop-down list:
- Controlling Field: Restrictions
- Dependent Field: Coffee
7. Click Continue.
8. Select the dependent picklist values using the Field Dependency Matrix.
9. Click Save.
How to Use Formulas for Default Picklist Values
Let’s go ahead and take it a step further and assign a dynamic default value to a picklist field based on specific criteria conditions.
1. From Setup, open Object Manager and select Product.
2. Click Fields & Relationships.
3. Open the picklist field, Coffee. Click Edit.
4. Scroll down to General Options to add the formula.
5. Click Save.
Change the Field Type to Allow or Prevent Multi-Selection
Salesforce allows us to change a custom picklist field to a multi-select picklist field and vice versa. When we change a multi-select picklist to a custom picklist, Salesforce automatically clears all the values for that field on existing records.
1. Let’s go back to Fields & Relationship page for the Object, Product.
2. Select Edit next to the custom picklist field, Coffee.
3. Click Change Field Type.
Keep in mind that changing the field type results in the deletion of all inactive values.
Global Value Sets
As mentioned, Global Value Sets enable us to share the same picklist values with multiple picklist fields. Changes in the global value set reflect in all picklists using it, and they are always restricted!
Example: The standard picklist fields, Lead Source and Account Source, share the same global value set.
Create a Global Value Set
Let’s create a global value set for the café. This value set includes all the ingredients necessary to keep the café running.
1. From Setup, type Picklist Value Sets in the Quick Find Box, then click Picklist Value Sets.
2. Click New next to Global Value Set.
3. Enter the Label for the value set.
4. Enter the values, each separated by a new line.
5. Click Save.
Let us Use the Global Value Set in a Picklist Field
Let us move on to the next step and assign the Global Value Set we created to a custom picklist field.
- From Setup, open Object Manager and select the Object containing the custom picklist field.
- Click Fields & Relationships, and click New.
- Select Picklist, and then click Next.
- Enter a Label.
- For Values, keep the default values option – Use a global value set. And select the Global Value Set from the drop-down list.
- Click Next, Next, and Save.
Manage Values for Global Value Sets
Just like we did with other picklist values, we can replace, reorder and alter the default value of a global value set. We can also edit, delete and deactivate individual values.
- From Setup, type Picklist Value Sets in the Quick Find Box, then click Picklist Value Sets.
- Open the global value set you just created to view its details.
This page works just like a picklist field detail page:
- Click Edit to make changes to the Label, API Name, or Description of the set.
- Scroll down the Values-related list to change the individual values or their properties.
Although changes made to the global value set reflect in all picklist fields that use the set, individual fields that use the global value set can have unique default values separate from the global value set’s default value.
Promote Existing Field Values to a Global Value Set
What if a value set for a picklist field works incredibly well, and, as the admin, you would want that as a global value set? → Well, Salesforce has a simple solution for that! Let’s find out how to get that done with just a click.
1. Navigate to the Fields & Relationship page of the Object that contains the picklist you plan to promote to a global value set.
2. Open the picklist field’s detail page.
3. Click Edit.
4. Click Promote to Global Value Set.
5. Enter a Label for the global value set. The Name auto-populates, and optionally, you can enter a Description too.
6. Click Promote to Global Value Set.
Well, that’s it. I’m sure you’re a pro at picklists now!