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:

27 thoughts on “Default Flow Picklist Value Without Duplicates In New Flow Builder”

  1. Hi Luke,

    Thanks for this tutorial! I found it very helpful.

    I did get stuck trying to find the EntityParticleId for a custom field I have on the Contact Object.

    I tried your query, but I kept getting the error ‘Unknown error parsing query’.

    Any ideas where I went wrong??

    My query:

    SELECT EntityDefinitionId, QualifiedAPIName, FieldDefinitionId
    FROM EntityParticle
    WHERE EntityDefinition.QualifiedApiName = ‘Contact’

    Appreciate the help,
    Carmen

    1. Your query is working perfectly for me. Might be you just copy-paste from web browser. Just remove you a single quote and add again it will work.
      I added one more condition for picklist
      SELECT EntityDefinitionId, QualifiedAPIName, FieldDefinitionId
      FROM EntityParticle
      WHERE EntityDefinition.QualifiedApiName = ‘Contact’ and DataType = ‘picklist’

  2. Hi, I have been trying out your solution which looks fine except one thing. I have a flow with multiple screen elements and one of them is having a picklist configured as per your solution. If I select a value in the picklist, move forward to the next screen and then come back using the Previous button, the picklist loses the previously selected value and resets to the first one in the list. Would you have any suggestion?

    Thank you

    1. Hi Lora,

      I have the same issue? Did you get any fix for this?

      @Claudia, the checkbox “Manually assign variables (advanced)” appears for elements which require Lightning Runtime (e.g. Lightning component embedded in a flow screen). Since, this is a standard Picklist element of screen flow, we don’t have that option here.

  3. Thanks for the post!

    It seems it does not work for Global Picklist… Do you know how to do it?

  4. Used this… and I love it (who cares what my client thinks, right?). Great solution that eliminated my duplicate values and got rid of my variable names. It just looks cleaner.

  5. Hi,
    Great solution! One question, How do you deselect a picklist value? It does not show –None– or in your case “Select an Industry”. What if I want to make a field null?

  6. Variable {!Current_Account_Industry} is not defined any where.
    Is it {!Current_Account_Industry} or should that be {!Current_Industry}”?
    for Value does not equal {!Current_Account_Industry} (Industry_Picklist_Choices)

  7. what type of variable is the AccountRecord?

    That does not seem to be defined anywhere. Is it a record choice or just a straight variable?

  8. A couple notes re: the EntityParticle lookup in Workbench:

    – If you copy the SOQL query directly from this website, replace the single quotes by deleting and manually retyping; their rich text counterparts are used here, and Workbench doesn’t recognize them.
    – I kept getting a “too many records” warning when running the query so am using an additional SOQL WHERE component to query only the specific field I’m looking for:

    SELECT EntityDefinitionId, QualifiedAPIName, FieldDefinitionId
    FROM EntityParticle
    WHERE EntityDefinition.QualifiedApiName = ‘OBJECT_API_NAME’ AND QualifiedApiName = ‘FIELD_API_NAME’

  9. I found a way you can get the Field Definition Id without having to use SOQL query. This works better as you don’t have to hardcode values.
    1. Use Get Records element to get Entity Definition object where QualifiedApiName equals . Store the Durable Id in a variable.
    2. Use another Get Record element to get Field Definition where QualifiedApiName equals and Entity Definition Id equals Durable Id(From Entity Definition). Store the Durable Id from Field Definition in a variable.
    2. use the Field Definition Durable Id variable in your record choice picklist filter

    1. Sean,

      Usually, I would agree with you to not hard-code values. However, using 2 Get Records for this when it’s very unlikely for this to change, is a waste of limits and performance. The Id would differ for new picklists in a sandbox as it gets deployed up through the pipeline but eventually, it’ll be the same as the various orgs are refreshed. To combat that, one could use a custom setting, custom label or another configuration option to make that configurable and easily administered.

  10. Hi, I’m not sure what I’m doing incorrectly. I followed all of the steps (though I too would reiterate a previous comment of:
    Variable {!Current_Account_Industry} is not defined any where.
    Is it meant to be {!Current_Industry}”?
    ^This is referenced in your Record Choice Set, but not elsewhere on the post.

    My issue is that ONLY the default value is appearing, not any of the other choice values. Any ideas what I may be doing wrong?
    Thanks!

  11. How would you solution this if the picklist API code does not match the Display Value. It seems like the Default value formula will contain an API code and display it in the list when the rest of the values would be display codes?

  12. Hi, I have the same Issue that Rachel C. Any Ideas?

    Only the CurrentValue is appearing!
    Thanks!

  13. Hi, I found my problem.

    I had “Equals” when I was searching for my picklist choices.

    @Rachel C, maybe it’s the same for you.

    Thanks.

  14. Since I created a flow on a new picklist field in a sandbox, I could not rely on the FieldDefinitionId as that would be different once deployed in the production org.
    Here’s what I used as an alternative in the Record Choice Set filter of the Picklist Value Info:
    Instead of EntityParticleId = FieldDefinitionId, I filtered on DurableId Starts With CustomObjectAPIName.CustomPicklistFieldAPIName e.g. Container__c.Status__c.

  15. SELECT EntityDefinitionId, QualifiedAPIName, FieldDefinitionId FROM EntityParticle WHERE EntityDefinition.QualifiedApiName ='<sObject Name'

Comments are closed.