Skip to content

Avoid this Flow Entry Criteria Pitfall

Summary: In flow entry conditions, setting condition requirements to “Any Condition is Met (OR)” and that the flow runs “Only when a record is updated to meet the condition requirement” can lead to unexpected behavior.

When creating a record triggered flow, Salesforce allows (and encourages) you to enter various conditions, consisting of which fields must equal which values, that will determine if and when the flow will run.

For a flow triggered upon a record being updated, you can choose one of two further options as to “When to Run the Flow for Updated Records”. 

  • “Every time a record is updated and meets the condition requirements”, (henceforth in this article “Every time”) or
  •  “Only when a record is updated to meet condition requirements”, (henceforth “Only when”).

Being that entry conditions are needed to prevent excess automation (to avoid a whole host of issues), selecting the second option (“Only when”), which further reduces the criteria for when the flow will run, is generally a good idea.

Here’s the pitfall though. Entering multiple conditions with Condition Requirements set to

  • Any Condition is Met (OR)” 

    and selecting that the flow runs 

  • Only when a record is updated to meet the condition requirement” 

can cause confusing behavior, because under these combined settings, as soon as any of the conditions become true, the flow won’t fire again if another (previously false) condition becomes true.

For example, say you have two checkboxes, “Send Email 1” and “Send Email 2”, and a flow configured to send an email using corresponding email templates when either checkbox is checked.

One can mistakenly set the entry conditions as follows

The thought here is that the emails should be sent out at the time the “Send Email” checkboxes are checked, and not when other changes are made to a record where these checkboxes have already previously been checked.

What may not be apparent, however, is that unless both “Send Email” checkboxes are checked off at the same time, only the email notification corresponding to the checkbox first checked will be fired. 

This is because, at the time the second checkbox is checked, the record is not technically “updated” to “meet the condition requirement” (as the “Only when” option states), as it had already met the requirement when the first one was checked, since either checkbox independently satisfies the condition requirement (“Any Condition is Met”). Thus paradoxically, the “Any” requirement becomes restrictive in such a scenario.

Instead

You can leave entry conditions as none (or alternatively, “Every time”) but rigorously ensure that each decision element contains the proper criteria as below.

Because each decision element is only evaluating a single checkbox criteria, selecting “Only if..” (similar to “Only when” by the entry conditions) will produce the required behavior, and each checkbox will fire the email once at the time it is checked.

Further Optimization

If you want to further optimize your overall flow to not run at all unless necessary, change the entry conditions to explicitly check that each checkbox

  • Is changed and
  • Is true (i.e. checked)

As this will require four condition criteria, set custom condition logic to evaluate each group of conditions (per each checkbox) independently, as below.

Note that the “Is Changed” operator requires that the “Every time” option is selected.

Published inFlows

4 Comments

  1. Becca M Becca M

    I also had this issue with decision elements in a flow. Thank you for explaining!

  2. Donna F Donna F

    Thanks for writing this up! I fell into the pitfall and this helped me out of it.

  3. Chris Feldhacker Chris Feldhacker

    One way to think of the “Only When” scenario: Both the “before” and “after” record are evaluated against the entry criteria as a whole — if the result of the entry criteria evaluation is “false” for the before record, but “true” for the after record, only then is the flow executed. If the before record evaluates to “true” and the after record also evaluates to “true”, then no execution occurs — the exact reason why a “true” result was produced doesn’t matter.

    • That’s a good way to put it. So if the criteria is already evaluating to “true” for the before record (i.e. even before the user made the change), the flow will never run.

      In this case, once the first checkbox is checked, the criteria is already true before the second one has been checked.

Leave a Reply

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