Using Not Keyword in Flow Condition Logic

Using Not Keyword in Flow Condition Logic

There are many areas in Flow where you can use a condition to filter records or execute a decision outcome. It is possible to enter multiple condition rows and then apply a condition logic for those rows. Flow Builder allows you to select “All Conditions Are Met”, or “Any Condition Is Met”, or “Custom Condition Logic Is Met” to build the logic. First two options are pretty straight forward. However, if you select the third option, which is “Custom Condition Logic Is Met”, you have to enter the logic using the row numbers.

In the example below, Flow gets the case records that meet the custom condition logic. Numbers in the condition logic represent the rows. So if we translate this condition logic, Flow gets the case record which has its ContactId equal to the ContactId that is stored in a variable, and status of the case is either New or In Service Process.

Condition logic is a great feature that lets you build complex conditions. If you are an old school Flow user, you can remember that before there wasn’t even an option to build a logic.

Condition Operators

Depending on the field types, there are a few operators to select. For example, for text fields you can select Equals, Does Not Equal, Starts With, Ends With, Contains, and Is Null. For the number fields you have Greater Than, Less Than, Greater Than or Equal, Less Than or Equal options as well. However, if you are familiar with reports, you can see that some operators such as “Does Not Contain” are missing in Flow condition operators.

Operator options of Reports

Does it mean that there is no way to use that logic? Should I create a formula field with NOT(CONTAINS()) function in the object and then use it in the condition logic? Of course not, there is an easy way to do that.

Using Not Keyword In Condition Logic

When you choose to build a custom condition logic, you can use AND, OR, and parentheses to enter your logic. This is pretty clear and you can see an example above. However, you are not limited only to these three options. There is one more keyword that you can use in the custom condition logic and looks like many people don’t even know that it is supported.

You can use NOT keyword in condition logic to check the opposite of a condition.

In the example below, Flow gets the account records that do not contain “Test” in their name and their phone number doesn’t start with +.

It is possible to do the same trick for Does Not Start With and Does Not End With operators.

If you have a complex logic and want to check the opposite of it, you can put your whole logic inside the NOT keyword using parentheses.

For example;

Pay Attention to Help Texts

This is a great feature for sure, but looks like many people don’t know about it. Just because they don’t know about it, I saw many workarounds including creating a checkbox formula field that contains the logic itself and using this field in the flow criteria.

Sometimes we miss things that are very close to us. If you just stand on the “i” icon (help text) of the Condition Logic, you can see that it is written over there. So, I recommend you to pay attention to help texts, most of the time they are very useful.

To learn more about conditions in Flow, you can read this article.

4 Comments

  1. Just running into this while building a new flow. Would save a lot of time on my end! I m working around it but it s more complex than it ought to be.

    • Hi,

      It is good that you ran into this while building a new flow. I did many workarounds before just to achieve this, but looks like the solution was written in the help text. I just didn’t pay attention.

  2. Thanks so much for this article! This was exactly what I needed to add to my Entry Conditions so it would not run the Flow in certain stages.

Leave a Reply

Your email address will not be published.


*