Big Idea or Enduring Question:
What if your use case requires you to use DOESN’T CONTAINS operator in Flow?
With a sigh, you may want to remind me that, in Salesforce Flow, one cannot use the DOESN’T CONTAINS operator to filter the records!
My response? – So, what! We are savvy Salesforce users, aren’t we? If so then, why not improvise?!!! Let us be creative and think out-of-the box – after all, we are Salesforce Ninja for nothing!
Salesforce Flow indeed is one of the most powerful tools provided by Salesforce to implement business requirements declaratively. If so then, let us build on that by creatively repurposing elements within Salesforce to do things that, at a first glance, may not seem doable!
In this article, I am going to share my tricks with you to show you how you can use DOESN’T CONTAINS operator in Flow. Let us start with a business use case.
The CONTAINS function compares 2 text strings and is widely used in Flow, Validation Rule, Process Builder, and Workflow Rules to search for a character or string in a text field.
Returns TRUE if the word, “Invoice”, is found anywhere in NextStep.
This blog post will help us to understand the following
- When should you use Before-Save vs After-Save Record-Triggered Flow?
- Use a Decision element to filter out the result using the DOESN’T CONTAINS operator.
- Use After-save Record-Triggered Flow to create a record.
Business Use Case
Brenda David is working as a System Administrator at Universal Containers (UC). She has received a requirement from the management to auto-create a Task when the ‘NextStep’ field – on the Opportunity object – is updated and it doesn’t contain words like Closed or Lost.
- Task Due Date = Opportunity Close Date
Automation Champion Approach (I-do):
There are multiple ways to solve the above business requirement. You can either use Apex trigger, Salesforce Flow, Process Builder, and more.
To solve this requirement, we will use the After-save Record-Triggered Flow. Check out this article to understand why we are using after-save record-triggered flow for this scenario.
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 understand it. Let’s begin building this automation process.