Admins / Consultants / Flow

How to Check For Duplicates Using Salesforce Flow

By Andrew Cook

The Salesforce Summer ‘24 release brought even more functionality to an ever-evolving plethora of Flow Builder features. As mentioned by Tim Combridge in our 10 New Salesforce Flow Features in Summer ’24 Release post, one such feature is the ability to check for duplicate records directly within Salesforce Flow Builder. 

But how does it work? How does it differ from Duplicate Rules? In this post, we’ll go through just that, as well as helping you to decide which of these tools you should use.

Use Case

To showcase how this feature works, we are going to build a Screen Flow in Salesforce to create a new Lead record. When doing so, we are going to make use of the new duplicate check feature within Flow Builder.

First things first, let’s start by creating a new Flow. This can be done in Setup by going into the Flow menu, or by using the new Automation Lightning App, as seen in the screenshots below.

Next, as we won’t be using a template, select Start From Scratch.

Now select, the type of Flow you want to build. In this example, we’re going to be creating a Screen Flow.

Next, add a Screen Element, and enter the relevant fields you wish to capture. In this example, I’ve selected First Name, Last Name, Company, Title, Email, Phone, and Address.

Now, add a Create Records element to your Flow. Make sure to enable Check for Matching Records, and select the criteria. In this example, I’m checking to see if there is a match between the Company and Email. Unlike with Matching Rules, you don’t have the option for a fuzzy match here.

Once saved and activated, you will be able to create a new action to launch the Screen Flow and add to your relevant Lightning Record Pages.

Duplicate Rules

Duplicate Rules are sets of instructions that define how Salesforce should handle potential duplicate records when they are created or edited. They help to prevent duplicate data from entering your Salesforce org, which can lead to inconsistencies, reporting errors, and confusion for users. Duplicate rules consist of two main parts; Matching Rules and Duplicate Rule Actions.

Matching Rules specify the criteria that Salesforce uses to identify potential duplicates. They define which fields to compare (e.g., name, email, phone) and how to compare them (e.g., exact match, fuzzy match).

Duplicate Rule Actions determine what happens when a potential duplicate is found. They can include displaying a warning message to the user about the potential duplicate, preventing the user from saving the duplicate record, generating reports on duplicate records, and combining the duplicate records into a single record.

Which Should I Use?

With this new functionality in Flow Builder, you may wonder which option you should use. This will always come down to personal preference, but there are some things to keep in mind. Duplicate Rules are ideal for organization-wide duplicate prevention, especially for standard objects like Accounts, Contacts, and Leads. They are especially useful when you want to enforce consistent duplicate management across your org.

Checking for duplicates within Flow Builder, on the other hand, is more suitable for specific use cases within a flow’s context, rather than across your entire organization. They therefore provide greater flexibility and control over how duplicates are handled within the flow’s logic and can be used for more complex scenarios where standard Duplicate Rules might not be sufficient.

Summary

The new Check for Duplicates feature within Flow Builder is a great way to manage how specific flows handle duplicates. As demonstrated in the example above, it is easy to set up and is managed directly within the Flow, making it a welcome addition for anyone building automation in Salesforce.

Duplicate Rules remain the superior tool, offering enhanced functionality like fuzzy matching and displaying warning errors, which are not currently available in Flow Builder. Despite their complexity and the fact that they apply to all records in your org, the introduction of the Check for Duplicates feature provides a more straightforward and flexible option for specific use cases. Both features will likely co-exist in many orgs, allowing users to choose the best tool for their needs based on the situation. 

The Author

Andrew Cook

Andrew is 14x certified and has worked in the ecosystem for 12 years.

Leave a Reply