Tag Archives: Flow

Default Flow Picklist Value Without Duplicates

Flows are great but there are some quirks. One quirk is that a picklist input field can’t be prepopulated with the existing picklist field value from a record. There are some workarounds:

and there’s even an Idea: Flow – Pre-populate choices with dynamic values (variables).

The workarounds are good but one minor nuisance is that they cause the current picklist value on the record to be duplicated in the dropdown list.

Below is my solution that doesn’t have a duplicate option by using the PicklistValueInfo standard object in a Dynamic Record Choice.

High-Level Solution

  1. Query the record with the desired fields including the picklist field(s) using a Record Lookup or Fast Lookup.
  2. Create “Current Picklist Formula” that has an expression like “If(IsBlank(record.PicklistField), ‘Select an option’, record.PicklistField) so the formula can be used to dynamically use either the record’s picklist value if there is one or ‘Select an option’ if it’s blank.
  3. On a screen, create a picklist input with the following settings:
    • Choice – Use the current picklist formula as the label and stored value
    • Dynamic Record Choice – Use the PicklistValueInfo standard object to query all the picklist values except the currently selected value.
    • Set the Default to the “current choice”.

Industry Example

Let’s create a flow that allows one to quickly update the Industry field on an account record in Lightning.

Create recordId Variable

Query Account Record

Use a Record Lookup or Fast Lookup to query the account or desired record using the recordId variable. In the screenshot below, a Record Lookup is used. Note how the current industry is stored in the “Current_Account_Industry” variable.

Create Industry Default Choice Formula

Now, let’s create the “Industry_Default_Choice” formula that uses

  1. The “Current_Account_Industry” variable if it’s not blank.
  2. “Select an Industry”, otherwise.

Create “Selected Industry” Variable

Another quirk that drives me crazy is having to create a variable for a dynamic record choice to be saved to before it’s created. That’s needed because a dynamic record choice doesn’t allow one to create a variable on the fly like most other places.

Create a “Selected_Industry” variable like:

Create the Industry Input Field

Let’s start with the finished “Industry” dropdown list input field.

To create this, add a Dropdown List Input field to the desired screen.

Next, create a new “Choice” through the Add Choice link using the following settings:

The “Industry_Default_Choice” formula is used for both the Label and the Stored Value so they both can be dynamic. I.E. if the account has an industry, then it’ll be defaulted. Otherwise, “Select an Industry” is used.

Next, create the “Industry_Picklist_Choices” Dynamic Record Choice with the following settings:

Let’s break this down a bit. The “PicklistValueInfo” standard object contains all the picklist values for every picklist field on every object in the org. The “EntityParticleId” column has values in the format of <Object_API_Name>.<Picklist_API_Name>. In this example, the “Industry” field from the “Account” object is used so “Account.Example” is used to query all the Industry picklist records.

The second filter of “Value  does not equal  {!Current_Account_Industry}” will exclude the current industry, if there is one. If no industry is selected, all the active Industry picklist values are shown.

Now, simply use the {!Selected_Industry} variable as needed in the flow to do something with the selected value.


  • The list of industry picklist values are dynamic and change automatically without having to alter the flow as the Industry picklist values change.
  • The inactive picklist values are automatically excluded.
  • There’s no duplicate value in the list.


  • The picklist values available per record type aren’t honored. The user sees all the active picklist values.

What did you think of the solution?


Flows in Lightning Experience

Today I want to share some interesting “Flow Nuggets” I learned recently about using Flows within Lightning Experience.

Flows Are Usable In Lightning Experience

First, you can embed Flows onto Lightning pages using the Flow standard component which is currently in Beta. The Flow component can use Flows whose type is “Flow” aka Flows that have screens in them.

This allows for interesting use cases such as creating a wizard with a Flow on a stand-alone Lightning page. For example, perhaps you want to create a commission calculator wizard.

Note: They are also styled using Lightning so they look and feel like they belong in Lightning. Previously, they were, by default, styled as Salesforce Classic even though they could be embedded in Lightning with a Visualforce component and page.

How-To Steps

  1. Create an active flow whose type is “Flow”.
  2. In the Lightning App Builder, edit a page.
  3. Drag the Flow standard component onto the page and select the Flow to use.
  4. Configure any input variables as needed.
  5. Save.

Lightning Flows Can Be Record Aware

Lightning can pass the record’s id to your flow component when on a record page. If your flow has an input variable defined whose name is “recordId” and it’s embedded on a record page, Salesforce automatically passes the record’s id into your flow so you can use it.

This opens up other interesting possibilities such as:

  1. Creating Automated Flows When A Record is Opened. Technically, this isn’t supported but this could be a workaround where the flow queries the record first, does some computation(s), and then updates the record or other records.
  2. Since the flow has the record id, it can query any information from that record or related records and use that in a more context-sensitive way. For example, your commission calculator can now be embedded on your opportunity records and calculate your territory specific commission based on the opp’s products, the account executive’s commission rates and other variables.

Note: If you create an Automated Flow that updates the current record’s fields, those fields may not show the updated values because Salesforce doesn’t have a way, currently, to tell other components on the page from flows to refresh other components.

How to Run Flow from Page Button in Lightning Experience

Douglas Ayers Blog Post shows how one can use an Action button to open a Flow in Lightning to do other use cases. His example is another “Automated Flow” but it’s activated by a user instead of automatically when a record is opened.

What other ways have you used Flows in Lightning? What limitations have you come across?