Flow: How To Use “Choice”
Choice is a resource type and it is only available in Screen flow, and it can only be used in the specific inputs on a Screen component, namely Checkbox Group, Radio Buttons, Picklist, Multi-Select Picklist, and Dependent Picklists. (What to learn about all the inputs on Screen component? Check here)
There are three types of Choice – Choice, Record Choice Set, and Picklist Choice Set. Let’s go through how each of them works.
Essentially, the purpose of having a choice is that you can let it display one value, but represents another one. For example, you can let the choice shows a sentence like below:
But assign the value as True:
So once an user chooses this choice, the value will be registered as True, instead of “I want to sign up for the blog”.
There are five data types for choice, and for text type, you can even display a text input for users to enter the value, like “Other” option for example.
After you create all the choices, putting them all into the screen component.
2: Picklist Choice Set
As you might have noticed, if you use the “choice” resource, you will have to create them one by one. When you want to show many options, this will take a considerate amount of time. This is when the choice set can help.
If the options are exactly the same as one of your picklist field, you can use the picklist choice set to get those values as a choice resource. Simply choose the right object, the data type of the existing field (either regular or multi-select picklist), and the target field.
Then instead of putting several choices in the component, you only need to put one choice set.
3: Record Choice Set
Record choice set is an interesting resource. It consists of three steps:
- Get all the records that meet certain criteria
- Choose one field and make a choice set of the values of that field of all selected records from step 1
- If a record is chosen by user, store more fields of that record
It might sounds a bit complex, so let’s use an example:
To get all the accounts owned by me (step 1), and use the account name of those accounts as choice set (step 2). If an account is chosen, I want to save the website and email as well (step 3).
How does one validate the input text? When a certain choice is chosen, I would like to require that the user enter a number. Thanks!
This is great, I would like to understand when you have Multiple Options enabled in the Record choice list. How do you show them ?
Bcz, when Multiple Options is enabled, the recordchoice set stores the recent record id only not all records Id.
Any suggestions on this ?
Hi Shan, I am a bit unsure what you mean by Multiple options enabled and only show recent record id. Could you elaborate more or use a screenshots?
I think Shan is asking (with regard to Record Choice Sets) how do you access the multiple record IDs if “multiple options” is enabled on the Picklist or Radio Buttons screen component. But it appears only ONE record is retained with a choice set. Is that correct? See screenshot.
I see, thanks for the explanation! Unfortunately the choices are still acting a bit weird in Flow (ex. choices returned as a string with labels as values) – but there is this workaround that is very useful! Hope this will help:) https://unofficialsf.com/from-jeff-kranz-use-collection-filter-to-convert-selected-screen-choices-to-a-record-collection-without-apex/?utm_source=rss&utm_medium=rss&utm_campaign=from-jeff-kranz-use-collection-filter-to-convert-selected-screen-choices-to-a-record-collection-without-apex
How can we disable Radio Buttons?
Hello! Could you elaborate more on disabling Radio Buttons? What would you like to achieve?
How can i Extract Choice set Label in other screen.By Selection of Radiobutton ,picklist ,we can get Value by Using that API name,but how can i get that Picklist/Radio button selected choice Label?
Hi Hari, the labels are only for the display purpose. There are two scenarios where labels can be stored but that’s given that values are not (Meaning you can only get one): https://help.salesforce.com/s/articleView?id=sf.flow_ref_resources_choice.htm&type=5
Hope that helps!
How do you only display the picklist choices if there are different choices available based on a record type?