Duplicate Management With Flows
Updated: Oct 31
Scenario
The nonprofit organization, Mountain Toppers, is excited to launch their new summer backpacking program - Walk to the Top. The program is designed to engage, educate, and empower foster youth through adventure, outdoor exploration, and outdoor education. There is a ton of buzz in the community about this new program, and interest from foster youth to apply has skyrocketed. To accommodate this, Mountain Toppers has decided to launch a new online application and would like to track and manage these program applications directly out of Salesforce.
Technical Requirements
Mountain Toppers would like a new Application record to get created in Salesforce whenever an online application is submitted.
Mountain Toppers would like to use the information from the Application to create a new Contact in Salesforce.
Before a Contact is created in Salesforce, Mountain Toppers would like to make sure that Contact doesn’t already exist in the database. If that Contact does already exist then Mountain Toppers would like the Application to be associated with that existing Contact.
What We Will Cover
Creating a custom Application object
Creating a matching rule and duplicate rule
Installing an Apex Action
Building our Process Automation with a Salesforce Flow
Technical Details
The Technical Details are organized in the proper order to follow for these configurations.
Step 1: Create the Application object
If you want more information on creating the Application object then check out our blog post here.
Field Creation
Field Name & Data Types (be sure to set your profile’s Field Level Security to “Visible”)
First Name
Data Type = Text
Last Name
Data Type = Text
Mobile Phone
Data Type = Phone
Personal Email
Data Type = Email
Date of Birth
Data Type = Date
Contact
Data Type = Lookup
Related object = Contact
Step 2: Create a Matching Rule and Duplicate Rule
Matching Rule Creation
Contact Matching Rule
Go to Setup → Matching Rules
Select New
Name = Contact Matching Rule
Contact Matching Rule Settings
Mobile Phone - Exact
Home Phone - Exact
Work Phone - Exact
Work Email - Exact
Personal Email - Exact
Set Filter Criteria:
1 or 2 or 3 or 4 or 5
Activate your Contact Matching Rule
Duplicate Rule Creation
Contact Duplicate Rule
Go to Setup → Duplicate Rules
Name = Contact Duplicate Rule
Object - Contact
Record-Level Security - Bypass sharing rules
Actions:
Actions on Create - Block
Action on Edit - Block
Matching Rules
Compare Contacts With - Contacts
Matching Rule - Contact Matching Rule
Activate your Contact Duplicate Rule
Step 3: Install Apex Action & Create Record-Triggered Flow
Install Apex Action
Duplicate Record Check
Install this Apex Action provided by UnofficialSF
Create Record-Triggered Flow
Flow Instructions
Go to Setup → Flows
Select New Flow
Select Record-Triggered Flow
Object = Application
Trigger the Flow When - A record is created
We only want the Flow to run when an Application is created because that represents when the Application was submitted by a potential program participant.
Condition Requirements - None
Optimize the Flow for - Actions and Related Records
Actions and Related Records is another way of saying that this Flow will run after the Application has been saved to the database. Because we will need to access the installed Apex Action (from the step above), this Flow must run after the Application is saved.
Create Record Variable
This Contact record variable will be used in the Apex Action, Duplicate Record Search. More to come here in a bit.
Set Information for Duplicate Search
Now, we will set that Contact's phone and email information equal to what is listed on the Application.
Amazing, now we have the information we need to perform a duplicate search using the duplicate rule we created earlier.
Perform Duplicate Search Using Duplicate Record Check
Create a New Contact or Use an Existing Contact
Based on the outcome of the duplicate search, we will either create a new Contact or use the existing Contact that was found during the duplicate search.
That's a Wrap!
Phew - Mountain Toppers was really concerned about integrating their online application with Salesforce because of the potential duplicate problems it would cause. With this simple but highly effective solution for duplicate management with flows, they can be less concerned about data cleanliness and more concerned about creating a great experience for the Foster Youth joining their program.
That's it for now, but in the meantime...