Ever Needed to Select Multiple Picklist Values in Flow? How About via a Single Condition?!

Ever Needed to Select Multiple Picklist Values in Flow? How About via a Single Condition?!

Last Updated on June 7, 2022 by Rakesh Gupta

Salesforce Flow is one of the most powerful tools provided by Salesforce to implement business requirements declaratively. Till date, I have written 200+ flows just for my blog posts!

Salesforce Flow helps businesses to save time, as well as money, by implementing solutions quickly. Implementation of Salesforce Flow is straightforward – you create a Flow; tests it; and then, use Change Set to deploy it to Production. The best part is, you do not have to write test classes for your Flows. 

But there are few limitations of Salesforce Flow vis-a-vis Workflow! Yup! You read that right! Workflow has an upper hand when defining Rule Criteria!

Let me unravel this mystery by offering an example: As a System Administrator, you receive a requirement to auto-create a Quote record whenever Opportunity Stage is Proposal/Price Quote or Negotiation/Review

To achieve the above business requirement, through a Workflow Rule, you may do something similar to as shown in the following screenshot: 

But to achieve the same requirement through Record-Triggered Flow, you may do something similar to as shown in the following screenshot:  

If you created Record-triggered Flow using Salesforce Flow before then, you know how I set two values for Stage picklist. But, for those, who are relatively new to Salesforce Flow, let me walk you through the flow step-by-step. Workflow Rule allows you to select multiple values for a picklist. If you look at the Workflow Rule screenshotI have chosen (defined) both the picklist value in a single line using commas (,). 

But if you try to achieve the same thing using the Record-triggered Flow, it will not work. Unlike Workflow rules, one cannot develop a rule criteria to select multiple picklist values, in a single stroke, using Record-triggered Flow! For the detailed explanation, please refer to the following article published by Salesforce – CONTAINS with multiple comma separated values does not trigger a Flow.

The solution suggested by Salesforce (is the same as I have used in Process Builder screenshotis good for the simple business use case. But what about a complicated requirement where you need to take other things into consideration (like Amount > $1000 and Close Date > Today) while defining flow entry criteria? 

Ugh!! what a nightmare – Prone to errors and a whopping headache!

For, in the aforementioned scenarios, you will be using multiple AND/OR statement, as I did in the preceding screenshot – (1 OR 2) AND 3 AND 4.

Thanks to highly talented users of automationchampion.com blog for their constructive feedbacks and, especially, for challenging me to come up with a streamlined solution for the aforementioned problem. Well, challenge accepted!

In this article, I am going to share my tricks to solve the above business use case using a simple formula. Let us start with a business use case.

Business Use Case

Edward Backhouse is working as System administrator at GurukulOnCloudAt GurukulOnCloud they are using Record-triggered flow to streamline Sales Processes. Today, Edward received a requirement to auto-create a Quote record – as soon as an Opportunity meets the following conditions: 

  • Stage = Proposal/Price Quote or Negotiation/Review
  • Amount > 1,000
  • Close Date > Today

Automation Champion Approach (I-do):

There are a few possible solutions for the above business scenario, but I’ll use After-save Record-Triggered Flow to solve the business requirement. Let us spend some time to understand the Case formula in Salesforce and how to use it. 

Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes going through the following Flow diagram and understanding it.

Let’s begin building this automation process.

Guided Practice (We-do):

There are 4 steps to solve Edward’s business requirement using Record-triggered Flow. We must:

  1. Define flow properties for record-triggered flow
  2. Create a formula to determine if the stage is matching 
  3. Add a decision element to check stage, amount, and close date criteria 
  4. Add a create records element to create a quote 

Step 1: Define Flow Properties

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. Select the Record-Triggered Flow option, click on Create 
    1. Object: Opportunity
    2. Trigger Opportunity Flow When: A record is created or updated
    3. Set Entry Criteria
      1. Condition Requirements: None
    4. Optimize the Flow For Action and Related Records
  5. Click Done.

Step 2: Formula to Determine if the StageName is Matching 

  1. Under Toolbox, select Manager, then click New Resource to determine whether the record is created or updated.
  2. Input the following information:
    1. ResourceType: Formula
    2. API Name: forT_StageName
    3. Data Type: Text
    4. Formula:
      1. CASE({!$Record.StageName} ,
        “Proposal/Price Quote”, “True”,
        “Negotiation/Review”, “True”,
  3. Click Done.

Step 3: Using Decision Element to Check Stage, Amount, and Close Date Criteria 

Now we will use the Decision element to check if stagename, close date, and amount as described in the requirement. 

  1. On Flow Designer, click on the +icon and select the Decision element.
  2. Drag-and-drop Decision element onto the Flow designer. 
  3. Enter a name in the Label field; the API Name will auto-populate.
  4. Under Outcome Details, enter the Label theAPI Name will auto-populate.
  5. Condition Requirements to Execute OutcomeAll Conditions Are Met (AND)
    1. Row 1:
      1. Resource: {!forT_StageName}
      2. Operator: Equals 
      3. Value: True
    2. Click Add Condition
    3. Row 2:
      1. Resource: {!$Record.Amount}
      2. Operator: Greater Than
      3. Value: 1000
    4. Click Add Condition
    5. Row 3:
      1. Resource: {!$Record.CloseDate}
      2. Operator: Greater Than
      3. Value: {!$Flow.CurrentDate}
  6. Click Done.

Step 4: Add Create Records Element to Create a Quote

The final step is to create a quotation record. For this, we will use Create Records element.

  1. On Flow Designer, below the Yes node, click on the +icon and select the Create Records element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Input the following information:
    1. How Many Records to Create: One
    2. How to Set the Record Fields: Use separate resources, and literal values
    3. ObjectQuote
    4. Set Field Values for the Quote
    5. Row 1:
      1. Field: Status
      2. Value: Draft
    6. Click Add Field
    7. Row 2:
      1. Field: OpportunityId
      2. Value: {!$Record.Id}
    8. Click Add Field
    9. Row 3:
      1. FieldName
      2. Value:{!$Record.Name}
  4. Click Done.

In the end, Edward’s Flow will look like the following screenshot:

Once everything looks good, perform the steps below:

  1. Click Save.
  2. Enter Flow Label the API Name will auto-populate.
  3. Click Show Advanced.
  4. API Version for Running the Flow: 55
  5. Interview Label: Use Formula in Flow {!$Flow.CurrentDateTime}
  6. Click Save.

Almost there! Once everything looks good, click the Activate button.

Proof of Concept

Next time, when Opportunity records are created, or updated, by the user, the flow we created (Using Record-Triggered Flow) will fire and check the criteria. If it meets the stated criteria then, the record-triggered flow will create a Quote record, as shown in the following video: 

I hope you can learnt from the blog about how to select multiple picklist values using Salesforce Flow!! Yes, go ahead! Show off your newly acquired skills to your friends, colleagues and families!

Jokes apart, mastering these skills will enhance your productivity and propel you to try various permutations and combinations to incorporate automation in your day-to-day processes and procedures.

Formative Assessment:

I want to hear from you!

What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.