Dependent Picklists, a Flow Screen Component
NOTE: This component is basically obsolete. Flow now includes a dependent picklist as an official component. You should have a good reason to bother dealing with the community component, which paved the way and served nobly, but is now deservedly retired.
Watch the Video . Get the Source Code . Go get this component (not recommended)
Flow users have been asking for a one-screen dependent picklist solution for a long time. For those not familiar with this UI combination, it works like this:
Starting with a single set of choices that comes from a standard Salesforce field of type “picklist”…
Depending on the value you pick….
…you get a different set of choices in the second, dependent selection control:
DependentPicklists is an installable Flow Screen Component that works on Spring ’18 and later orgs. Each pair of picklists can be configured using the standard Cloud Flow Designer tools. This is what the control shown in the above images looks like, configured:
Let’s walk through the process of setting up a dependent picklist:
- Enable your org to run Lightning Components in Flow Screens. You need to have the “Enable Lightning runtime for flows” checkbox checked in Process Automation Settings, and you need to have My Domain configured.
- Install the DependentPicklist component. We’re working on making this component installable from AppExchange and possibly part of the included set of base screen components in the future, but for now you need to install it yourself.
- Add it to a Flow Screen. This is described here.
- Configure it. (See Configuring a DependentPicklists Component, below)
Configuring a DependentPicklists Component
The control consists of a “Parent” selection control and a “Dependent” selection control. The main job you have, when you configure this control, is to tell the control, for every possible value that can be selected in the Parent control, which dependent picklist to use to populate the Dependent control. Let’s look at the picklists we’re using in the example visible above:
For the Parent select, we’re going to use the IssueType Picklist custom field, which looks like this:
Step 1: Configure the Parent Control
For this control you need to tell the component which object and field to use to populate the Parent select control. Simply type the object and field names into the attributes Parent Object Name and Parent Field Name:
Step 2: Link each Parent Value to a Dependent Picklist
There are three possible values for this Parent control, so we need to provide the component with guidance for all three possibilities.
To do this, in Flow, you enter a pair of values:
- a specific possible “choice”, such as “PrivateBank”
- if that choice is selected, what dependent picklist should be used for the Dependent controls.
This image shows two of the three pairs of information:
The interpretation should be pretty clear, if the user selects the value International in the Parent control, the component will go and find the picklist values from that field.
Note that while the component assumes by default that all of the dependent picklists are on the same object as the Parent, you can specify a picklist on a different object, by entering it like this:
3) Map your Output Values
As always you need to map your output values to Flow variables so you can do something productive with the values entered by the user.
The two output values are shown here:
Hope this is useful! If you want to customize this control, the source code is available here.
Finally, I want to give a special shoutout to Piyush Soni. I used a lot of code from his solution for using APEX to get field describes. Nice work, Piyush!
Note that this is not an official Salesforce product or release.