How To

Using Dependent Picklists in Screen Flows

DependentImage.jpg

(Note: This blog posts only covers how you configure a dependent picklist for use in a screen flow and how to reference the picklist values selected by the user, and not all the steps to complete the flow.)

With Winter ’20, Salesforce introduced a standard dependent picklist component for use in a screen flow. Now, depending on what the user selects from a picklist (controlling), we can show picklist items dependent on that first selection in a screen flow.

Business Use Case:  Addison Dogster is the system administrator at Universal Containers.  Addison received a requirement to show a dependent picklist in a screen flow, just like on the Swag record. When a user selects a value from the Status picklist, the Open for Offers field is populated with only the picklist items for a given status.

Solution: Addison recalled reading about the Dependent Picklist feature in Flow Builder in the Winter ’20 Release Notes and is excited for the opportunity to give it a whirl.

FlowDependentPicklist.GIF

Quick Steps:

Pre-requisites:

  • Create a custom picklist field (Status).
  • Create a custom picklist field (Open for Offers) and set Status as its controlling picklist.

DependentPicklistInSetUp.GIF

View image full screen

1. Let’s create the flow. In Setup, for Classic, go to  Create | Workflows & Approvals | Flows. In Lightning Experience, it is found under Process Automation | Flows.

A. Draw the Screen flow element to the canvas.

B. Drag the Dependent Picklist standard component to the screen area and configure it accordingly.

  • API Name: DependentPicklist
  • Object API Name: Swag__c
  • Picklist 1 API Name: Status__c (This is the controlling picklist’s API name)
  • Picklist 2 API Name: Open_for_Offers__c (This is the dependent picklist’s API name)

FlowScreen-DependentPicklist.GIF

View image full screen

Note: When you need to reference the dependent picklist selection by the users in your flow, you will find it here…

Let’s say we are creating a new record and setting the status__c and open_for_offers__c fields using the values selected by the user.

You’d want to pay close attention here since the name of the reference fields is not what you would expect. I would be looking for something called “Picklist 1 Value” or “Picklist 2 Value,” not “topValue” and “middleValue,” respectively.

  • Status__c: {!DependentPicklist.topValue} [Note: topValue is the picklist 1 value]
  • Open_for_Offers__c: {!DependentPicklist.middleValue} [Note: middleValue is the picklist 2 value.]

FlowScreen-SetDependentPicklistValue.GIF

View image full screen

That’s how to configure the dependent picklist on a screen flow and how you reference the picklist user selections.

That’s all folks.

Deployment Notes/Tips:

  • The flow, custom object and custom fields can be deployed to Production in a change set (or can be deployed using a tool such as Metazao’s Snapshot).
  • Don’t forget to update the custom field’s FLS and object access for the profiles that will use the flow.
  • You will find the flow in a change set under the Flow Definition component type.
  • Activate the flow post deployment as they deploy inactive in Production, unless with Winter ’19, you have opted in on the Process Automation Settings screen, to “Deploy processes and flows as active.” NOTE: With this change, in order to successfully deploy a process or flow, your org’s Apex tests must launch at least 75% of the total number of active processes and active autolaunched flows in your org.

 

4 thoughts on “Using Dependent Picklists in Screen Flows

  1. This is really helpful, thank you!

    A reminder to all: API names of objects and fields are Case Sensitive! I built this, missed a capital letter on my Object__c (not object__c) – no end of frustration, totally self-inflicted.

    Any idea how to set a default value on the primary picklist?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s