Default Flow Picklist Value Without Duplicates In New Flow Builder

In case you didn’t hear or notice, Salesforce has a new UI for building Flows that is much easier to use and isn’t dependent on Flash. It still has all the same capabilities as it did previously and hopefully with new ones coming soon.

With this change, Salesforce has changed how things work and my workaround for Default Flow Picklist Value Without Duplicates so this post shows how to do that in the New Flow Builder. See that post for good background info.

High-Level Solution

  1. Query the record with the desired fields including the picklist field(s) using a Get Records.
  2. Create “Current Picklist Formula” that has an expression like “If(IsBlank(Text(record.PicklistField)), ‘Select an option’, Text(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”.

Account’s Industry Example

Let’s create a flow that allows one to quickly update the industry field on an account in Lightning. The industry field is a standard field.

Create recordId Variable

Query Account Record

Use a “Get Records” to query the account using the recordId variable. Note how the current industry is stored in the “AccountRecord” variable.

Create Industry Default Choice Formula

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

  1. The “AccountRecord.Industry” if it’s not blank
  2. Otherwise, “Select an Industry”.

Create “Selected Industry” Variable

The selected industry will be stored in a variable so let’s create one. In the old Cloud Designer, one couldn’t create the variable from the Dynamic Record Choice screen but that can be done now in the new Flow Builder so technically this can be skipped until later but am keeping the same content as the old one for posterity.

Create the Industry Input Field

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

To create this, add a “Picklist” component to the desired screen.

Next, create a new “Choice” through the “+ New Resource” button after clicking into the empty Choice textbox. Use the following settings to create the “Current_Industry”:

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_Identifier>.<Picklist_Identifier>. For standard objects, the object’s API Name is used for the “Object Identifier”. For standard picklist fields, the Field’s API Name is used for the “Picklist_Identifier”. In this example, “Account.Industry” is used.

Note: If it’s a custom picklist field, see the Custom Picklist Field Considerations section below to determine the correct EntityParticleId value.

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, use the {!Selected_Industry} variable as needed in the flow to do something with the selected value.

Benefits

  • 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.

Limitations

  • The picklist values available per record type aren’t honored. The user sees all the active picklist values.
  • 200 is the limit of how many picklist values can be shown in a picklist. If there are more than that, they aren’t shown. Kudos to Sharath Prabhu for sharing that.
  • Depending on where the flow runs, the running user may not have access to the PicklistValueInfo object and no other picklist values will be shown. For example, community users with Lightning External Apps licenses.

Custom Picklist Field Considerations

Andy Kallio mentioned in this Success Community Post that custom picklist fields have an EntityParticleId like “Object.00NE0000000Y1CD” instead of “Object.Custom_Picklist__c”.

To determine the correct EntityParticleId to use,

  1. Query the EntityParticle object filtering by the desired object
  2. Find the desired field and then use the FieldDefinitionId value. Here’s the template SOQL query to use:

SELECT EntityDefinitionId, QualifiedAPIName, FieldDefinitionId
FROM EntityParticle
WHERE EntityDefinition.QualifiedApiName = ‘<SObject_Name_Here>’

After the correct FieldDefinitionId is found, use that in the Dynamic Record Choice so the correct picklist values are used. If you have a better way to get the field definition id, please let us know in the comments.

Let’s say that I have a custom picklist named “Status__c” on a custom Object named “Review__c”, here’s how to determine the FieldDefinitionId of
01IE00000008lA1.00N0L000006w12R for that by running the template query in Workbench:

1 thought on “Default Flow Picklist Value Without Duplicates In New Flow Builder”

Leave a Reply

Your email address will not be published. Required fields are marked *