Quick Choice – Improved Picklists and Radio Buttons for Flow

Quick Choice is a flow screen component that provides some features that aren’t available in the current picklist and radio button implementation in Flow Builder.

Features that SmartChoice provides:

  1. Accepts as an input a pair of string collections.
  2. Can accept a default value that’s dynamically determined by your Flow
  3. Can generate picklists from existing picklist fields with optional filtering based on recordType
  4. Supports ‘None’ Value and Requiredness
  5. Choices can be formatted as Radio Buttons, Picklist, or Visual Cards
  6. Visual Cards can be displayed with or without Icons
  7. Visual Cards can be displayed in single or dual columns

SmartChoice supports both picklists and radio button groups, set by passing in an Display Mode. For this document, we’ll always use “Picklist”. There’s no support for multiple select. If you need that, consider the Dual List Box flow screen component.

Creating Choices from String Collections

Use String Collections as your inputs by setting Input Mode to “Dual String Collections”. Pass in one collection for Labels and one for the underlying values (A typical use case for this is when you want your user to see a list of friendly labels, but you need to make sure that you can get the recordId of the selected label.)

Example: You want your flow to let the user choose a record type from a picklist and then display the layout corresponding to that record type (This is demonstrated in the video above). The Quick Choice package includes several utility actions that make this easy. You first start out with the GetRecordTypeInfobyObject action, which returns separate collections of recordTypeNames and Ids. You then use those as inputs to a QuickChoice control. When the user makes their choice, you use a couple of additional utility actions to extract the Layout fields for the layout that corresponds to the combination of the selected RecordType and the running user’s profile. The layout fields are then passed to the new RecordDetail flow screen component.

Tip: If you are starting with a collection of SObjects instead of a collection of Strings, you can use the ExtractFieldFromCollection flow action (provided in the same package as SmartChoice) but you’ll need to modify its Apex, swapping the references to “Account” for your chosen SObject.

Creating Filtered Choices from Picklist Fields

Many orgs take advantage of the ability to create record-type-specific sets of picklist values for picklist fields like Account.Type and Account.Rating. Flow already enables the easy creation of Picklist Choice Sets, which point at an existing picklist field. But you can’t filter a Picklist Choice Set on a specific Record Type. Quick Choice allows you to do that.

Start by setting the Input Mode to “Picklist Field”.

Pass in a string to ObjectAndFieldName that uses dot notation, like this: “Account.Type”. (If you’re using the Object and Field picker, use a formula resource to join the two values into this format)

Pass a record type ID in. If you don’t, the component uses the ID of the standard “Master” record type ID, which will result in no filtering. This package includes a useful utility function called GetRecordTypeInfoByObject that will return the record type Id’s and Labels for a given object type name. The video above shows how you can use QuickChoice first to let the user select a record type and then to show a set of filtered picklist fields.

Displaying Choices as Visual Cards

Set the Display Mode to “Card” and the Input Mode to “Visual Text Box” .

Pass in a collection of Strings in Choice Labels for the visual card headers, a collection of Strings in Choice Values for visual card descriptions and optionally a collection of icon references in Card Mode – Choice Icons for visual card icons.

If you are displaying icons, set the Card Mode – Include Icons in Display Box? parameter to True and set the Card Mode – Icon Size parameter.

The visual cards are displayed in a single column by default. Set the Card Mode – Number of Display Box Columns (1 or 2) parameter to 2 to display dual columns.

Visual Cards without Icons

Visual Cards with Icons

Dual Column Visual Cards

Requiredness Support

You can set the Required field to $GlobalConstant.True. If you do, Flow will prevent screen transition if the user selects ‘None’ or makes no selection at all.

Controlling the ‘None’ Choice

By default, there will be no “None” Choice. To add one, set the input “Allow None To Be Chosen” to $GlobalConstant.True.


General Attributes

Master LabelStringThe main label for the picklist or radio button group
Display ModeEnumEither “Visual”, “Picklist” or “Radio”, depending on which control you want
Input ModeEnum“Single String Collection”, “Dual String Collections”, “Picklist Field”, or ” Visual Text Box ” are currently supported
RequiredBooleanWill prevent transition if set to {!$GlobalConstant.True}
ValueStringThe selected value. This can be passed into QuickChoice, allowing you to set the default value dynamically.
Allow None To Be ChosenBooleanSet this to true to include a None choice. (For Input Mode “Picklist Field” only)

Additional Attributes When Using Input Mode = “Single String Collection”

Choice ValuesString CollectionThe values of your choices (The same collection will be used for Labels and Values)
The selected Label/Value will be returned by the component

Additional Attributes When Using Input Mode = “Dual String Collections”

Choice LabelsString CollectionThe labels of your choices
Choice ValuesString CollectionThe values of your choices (should be unique)
The selected Value will be returned by the component

Additional Attributes When Using Input Mode = “Visual Text Box ”

Choice LabelsString CollectionThe labels of your choices (should be unique)
The selected Label will be returned by the component
Choice ValuesString CollectionThe values of your choices (This is provided as extra descriptive text in the visual card)
Card Mode – Choice Icons
String CollectionIcon names formatted as icon_type:icon_name (Example “utility:attach”)
See complete selection at https://lightningdesignsystem.com/icons/
Card Mode – Include Icons in Text Box?BooleanDisplay the provided icons in the visual card
Card Mode – Icon SizeStringOptions include xx-small, x-small, small, medium, or large. This value defaults to medium.
Card Mode – Number of Textbox Columns (1 or 2) String1 or blank (default) for a single column or 2 for dual columns

Additional Attributes When Using Input Mode = “Picklist Field”

Object Name (for Picklist Field)StringExample: “Account” (this component no longer uses the combined “Account.Type” as an input)
Field Name (for Picklist Field)StringExample: “Type” (this component no longer uses the combined “Account.Type” as an input)
Record Type IdStringThis will default to the id of the Master record type

Install Package

Managed V1.23 (Production/Developer)
Managed V1.23 (Sandbox)

Version History

1/16/20Eric Smith
v1.23 – Added an option to display the visual cards in a single or dual columns

1/3/20 -alexed
v1.20 – changed actions to global from public to make them visible in flow builder.

12/31/19Eric Smith Enhancements
v1.17: Added visual text box selection with or without icons. Fixed error handling when Required is set to True

v1.13: Fixed bug with defaults on picklist control. Added flag to allow or disallow a ‘None’ choice

View Source


36 replies
  1. Stewart McNaught
    Stewart McNaught says:

    How is the Default Value set? I assume it would work with {!object.Field}
    Tried this a few ways and I am always given the “Select an Option” as default.

    Also is there a way to remove the “–none–” choice?

  2. Adam White
    Adam White says:

    Is this only available for Spring ’20? I tried installing the package and am not seeing the apex actions in the list of available actions.

      • Adam White
        Adam White says:

        If we want to use the Dual List Box component with a record type – filtered set of picklist choices, this package doesnt seem to have that functionality, correct? In my head one of these actions would be able to output a string/string collection of applicable picklist values given a record type/object/field name.

        • Alex Edelstein
          Alex Edelstein says:

          Right now, this component doesn’t output the record-type filtered list so you can use it downstream. It would be a good enhancement.

  3. Tamar Erlich
    Tamar Erlich says:

    Hi Alex, I installed version 1.17 in a Spring ’20 org and again I am not seeing the apex actions in the list of available actions.

    • Alex Edelstein
      Alex Edelstein says:

      Found the problem. Actions have to be Global and not Public in order to show up in Flow Builder if they’re packaged in a Managed package. Try new version 1.19

        • Tamar Erlich
          Tamar Erlich says:

          Hi Alex, I spoke too soon, the actions are showing up but have no available input or output variables showing. You can only set the Label, API Name and Description. A message below states: Nothing to set or store here. This core action has no inputs or outputs.

          • Alex Edelstein
            Alex Edelstein says:

            I should have thought of that. It’s the same thing with the variables. They also need to be global instead of public. Try the 1.20 version I just posted.

  4. Ward Wood
    Ward Wood says:

    Still seeing issues even with “Global”. I did get it to work with a two step workaround described below. See below for my small code snippet:
    “global class xxxyyyzzz implements Process.Plugin {…”

    My workaround was two-fold:

    1) To get my legacy action to show up, I flipped back to classic, fired up flow builder from there, and then I could find it.
    2) When I tried to save, I received “Can’t save new version of flow due to error: ‘xxxyyyzzz’ must implement the Apex interface ‘Process.Plugin'”. To get around this, I cloned the class, saved and then refreshed flow builder and voila, I could save.

  5. Jim Riggio
    Jim Riggio says:

    Hello, I have been trying to make QuickChoice work in my sandbox environment and following the video above.
    1) I created the Action with the same variables but used a custom object that has 4 Record Type.
    2) I built the Record Type Choice Screen using the same variables as the video.
    3) I get 5 choices, last one being “Master” which is not active or visible in Object Manager, Can I get rid of this?
    4) I created the next Select Member Screen, but it only lists “select an Option” and no options are listed.
    5) I am saving the selected Record Type value under a variable “selectedRecordTypeId” under “Value” field and assuming I am passing that into the member choice screen under “Record Type Id”, Is this correct?
    6) debugging see as this value as null, so not sure this is in the right place.

    What am I doing wrong?

    • Jim Riggio
      Jim Riggio says:

      Finally, after another day of trial and error, I finally got this working. My “Object Name and Field Name” were not displayed correctly. I went through video and reread the documentation several times before this clicked. I am not a developer per sec, but like trying out and using these components when I can because it allows me to do more automation in my flows.

      • Jim Riggio
        Jim Riggio says:

        ADDENDUM, I still am not able to get rid of the “Master” Record Type display, even though it is not listed under Record Types. Any Idea why it displays or how to get rid of it? I posted this question in “Salesforce Automation” in the community.

          • Jim Riggio
            Jim Riggio says:

            Thanks Tamar for this,
            Although I installed the Managed Package for this component, I am not well versed on taking the source code and creating a new package. Its currently beyond my capability, but want to get there soon.

            Can this be incorporated into the managed package at some point? Not sure of the review process. I am sure I am not the only one with this issue, no?

          • Alex Edelstein
            Alex Edelstein says:

            Tamara, really impressed that you modded the code. This isn’t simple stuff.

            I can incorporate it but would like to invite you to take the next step and create a pull request. It’s a great skill to develop and not that hard.

            Here’s some new content aimed at you and others who are making great strides in their ability to modify code.

            If you create a pull request, I’ll merge it in and generate a new package that Jim can use.

          • Alex Edelstein
            Alex Edelstein says:

            Tamar, your change is included in the 1.22 package. Can you try it and verify we got it in correctly?

        • Alex Edelstein
          Alex Edelstein says:

          Version 1.22 incorporates Tamar’s fix, so try it out. You need to set the new parameter “ignoreMasterRecordType” to True

          • Jim Riggio
            Jim Riggio says:

            Hi Alex and Tamar, Thanks for the update. I upgraded to 1.22 and verified in Installed Packages, but not able to locate the new parameter “ignoreMasterRecordType” on the component.. Is there something else I need to do to make it visible?

          • Tamar Erlich
            Tamar Erlich says:

            Hi Alex,

            The production/developer installation link points to v. 1.21 and the sandbox installation link points to v. 1.22 however after installing both versions, I cannot see the new toggle in the action.

            Jim, the new Toggle switch should be available in the invocable action GetRecordTypeInfobyObject that generates the dual string collections that can serve as the input for the screen component.

  6. Clifford
    Clifford says:

    Thanks for this great Flow Component! It works well and looks great. Generating visual picklists based on String collections is a nice feature. Two questions:

    1. How about licensing? I’m considering using this component in a productive org.

    2. Although, there are so many icons I can use (https://www.lightningdesignsystem.com/icons/), it would be really nice to use own graphics i.e. images as static resources. Is something like that possible?

    Best regards and a lot of thanks

  7. Heath Parks
    Heath Parks says:

    So, first off, thanks to everyone who is helping/doing the heavy lifting on these components/actions, etc. As a non coder, being able to do complex things without writing code is awesome. So, speaking of being a non coder, this post refers a lot to “String Collections”. Now I know a “String” is just more of less text, but I am struggling a bit with when/how/if to use this to display values or create variables to look into a record collection or how/when to assign them.. I am good at reverse engineering thinks, but I like being able to view the completed examples of the actual values, etc as it helps me figure things out.

    Are there any sites/help docs that give you some hands on or practical examples? I work for a non profit, so a lot of what we are doing is program/case management and funding. Just saying that to provide context.

    • Alex Edelstein
      Alex Edelstein says:

      String Collections are a little odd. A collection is just a list of things. Get Records generates lists of SObjects like Contacts and Records, so those are pretty obvious. And you can create a simple String resource in Manager.

      String Collections are generally going to be generated by another Action. For example, GetRecordTypeInfobyObject action, currently available in the QuickChoice package, returns a collection of names and a collection of recordIds. both of those are String Collections.

      You may not need to use String Collections at all. This component provide multiple paths for input data and you only have to use 1. What problem are you trying to solve with your picklists and radio buttons?


Trackbacks & Pingbacks

  1. […] have added a new parameter to the quickChoiceFSC component. You can now choose to display visual text boxes in a single column or side by side in […]

  2. […] I liked in the Lightning Design System called Visual Picker. At the same time I saw the new Quick Choice Flow Screen Component which offered an easy way to present and select choices using Radio Buttons […]

  3. […] Extract Fields from Records takes a collection and a field name, and returns a list of strings containing the values of those fields for the records. For example, if you pass in a list of Accounts and a fieldName of “Name”, you’ll get back a list of Account names. You can do this twice (once for names and once for ids) and then pass those two collections in to a Quick Choice picklist or radio button group […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply