Salesforce offers various standard screen components that you can use to collect input from users. They include multiple selection components like choice lookup, picklist, multi-select picklist, radio button, checkbox, and checkbox group. These selection components empower users to make choices from a predefined list of options. There are multiple choice resources in flow, each serving distinct use cases. It is important to understand the differences among these choice resources and to know which one is most appropriate for a given scenario.
There are 4 available choice resources in screen flow. Let's see their differences and limitations.
You can use a choice resource type to create a standalone choice when the available options are not present in an existing picklist field or as records. For instance, let's say that you have a screen flow that can create or update an account. When prompting the user to decide on the action (e.g., Update Account or Create Account), the choice resource type becomes the suitable option. You can use a picklist or radio button component with two choices (Update Account or Create Account). Then use a decision element to take an action based on the user's selection.
You can easily create those standalone choices by entering a text from the configuration of the selection component.
The second way of creating a new choice resource is using the new resource button from the toolbox. There you can enter the choice label (rich text), choice value, and choose data type (text, number, currency, date, boolean). Moreover, when the user chooses this choice, you can display a text input component under it.
2- Picklist Choice Set
You can use a picklist choice set if you want to display the choices already available in a picklist or multi-select picklist field. All you need is to choose the object name and an existing picklist or multi-select picklist field.
For instance, here is a picklist choice set for the Industry field from Account object.
While the configuration is straightforward, there are some limitations to note. Filtering out values isn't possible. It generates choices for all available picklist values and doesn't consider picklist dependency or record type. Additionally, there's no option to change the labels of the choices.
There are some advantages too. For instance, it is much easier to maintain the choices. When an admin adds a new value to the picklist field, the flow automatically incorporates the changes. It eliminates the need for manual updates.
3- Record Choice Set
There are two different choice resources that you can use to generate choices from records. One of these choice resources is record choice set. You can use a record choice set if you want to generate a set of choices by using a filtered list of records. It means that this resource displays Salesforce records as choices. Let's create a record choice set of open cases. Here is how to configure the record choice set.
First step is giving a name and selecting the object.
Next, input any necessary filter criteria, if applicable. Let's add a criteria because we want to create a record choice set of open cases. Just like the Get Records element (well, it is really doing a get), you can add a sorting as well. Moreover, you can limit the number of choices too.
Previous step was about choosing the records to display as choices. Now, it is time to configure the choices.
Choose the choice label and choice value. Label is the field that the users will see and the value is the value that the flow will store. For instance, users will see the case numbers, but when they choose a case, flow will store its Id. If you want to store additional values and not just the Id, you can select fields and assign them to variables. In this example, we are assigning the selected case's subject to a text variable named CaseSubject.
While this choice resource is highly valuable, it comes with a limitation that could be crucial in certain scenarios. Record choice set has a limit of 200 choices. It means that if there are more than 200 open cases in this example, then only the first 200 of them will be displayed as choices. This limitation can lead to confusion as users may struggle to find the specific record they are searching for.
4- Collection Choice Set
Similar to the record choice set, the collection choice set creates choices from records. If you already have a collection in your flow, you can utilize the collection choice set to generate a set of choices. Unlike the record choice set, the collection choice set allows you to generate choices from any item in your record collection. For example, you can generate choices from non-existing records (records that do not exist in the database). However, unlike the record choice set, this resource doesn't run a query to retrieve records from the database. Therefore, you can employ an existing collection and multiple collection filter elements to generate different sets of choices.
Here is how to configure a collection choice set.
After giving a name to the resource, choose an existing record or Apex-defined collection. Then choose fields for the choice label and choice value. Unlike the record choice set, you cannot store additional field values.
Here is a flow that retrieves all the cases, then creates two distinct collections using collection filter elements. As you can see, it performs only a single SOQL query.
Consuming less SOQL is a good advantage, but there is a better reason for going with a collection choice set. There is no limit of 200 choices! Collection choice set generates choices for all the items that you have in a collection. Therefore, if you need to display more than 200 record choices, then you must use a collection choice set.