6. April 2023

How to use duplicate rules in Salesforce

Setting up duplicate rules is a challenging task for all Salesforce administrators. You need to know which records your company considers as duplicate records and which does not. Salesforce provides some default duplicate rules to use, but these don’t need to meet your expectations. The reason behind it is easy – every company can consider different records as duplicates based on different field values. When you set Duplicate Rules right, there will not be any more duplicates. If you have duplicates already in your system, then you need to clean them. For that, you can use the Salesforce merge tool or try apps from AppExchange..

Duplicate and Matching Rules

For having excellent Duplicate Rules, first, you need to create excellent Matching Rules.

Matching Rules identify what field will be matched and how it will be matched. There are options like exact match or fuzzy match. After you set Matching Rules, you need to specify Duplicate Rules.

Duplicate Rules need Matching Rules to specify when and where to find duplicates. This combination of “fuzzy” or “exact” matches with specific objects like Account or Lead creates Duplicate Rules. After setting the Duplicate Rules you have your “guardian angel” prepare to actively protect your Salesforce objects against creating duplicates. And one more step is to set the level of protection – alert and block. Alert notifies the user that he is creating duplicity. Alert notifies the user that he is creating duplicity. Block doesn’t let the user create duplicity.

In Salesforce, you can find three default matching rules – Accounts, Contacts, and Leads. These Duplicate Rules are not the best ones because it doesn’t cover every scenario you may need. The best practice for this is to create your own Duplicate Rules or find some third-party app on AppExchange for free or buy one.

Now we look at some prevention steps and cure steps for fewer duplicates in Salesforce objects.

Prevent creating duplication


We’ll show you how to set up Duplicate Rules for Accounts, Contacts, and Lead.

First, we create an exact matching rule for the Account if we want to prevent multiple Accounts with the same name from being created.

After that, we create a Duplicate Rule for this Matching Rule, as you can see below. An important step is to pick “Block” on Create and Edit Actions because we don’t want to allow creating duplicates.

The second option is to create a fuzzy matching rule for the Account if we want to prevent creating potential duplicates where account names differ slightly.

Created Matching Rule now we use in Duplicate Rule. We allow users to create potential duplicates but before that, we notify the user, that he might be creating a duplicate account, and report about that when the record is edited.

Leads and Contacts

Creating rules for Leads and Contacts has 4 options, which need to be secured before duplicates are created. Here are the possibilities:

  • A new contact that is the same as an existing Contact
  • A new contact that is the same as an existing Lead
  • A new Lead that is the same as an existing Lead
  • A new Lead that is the same as an existing Contact

Contacts and Leads we can specify by the same email address. For that case, we create two matching rules – one for Contact and one for Lead.

And here are Duplicate Rrules for it:

Matching Rules are set strictly, so Duplicate Rules can have actions set on Block because an email address is always unique. Also, don’t forget to give your Alert Text a unique message, so you will know, why it appears and where you can find your duplicate record.

Clear Duplicates

When you already have duplicate records in your system you can use the built-in feature for merging potential duplicate records. Here you can select which field from which record you want to have in the final merged record. It is manual work but helpful when you need to merge only a few records.

In Salesforce, you can download deduplication apps from AppExchange to help you manage duplicate records in your system. These apps can do more than you can imagine.

Ján Petráš, Salesforce Consultant


  1. https://trailhead.salesforce.com/content/learn/modules/sales_admin_duplicate_management/sales_admin_duplicate_management_unit_1
  2. https://trailhead.salesforce.com/content/learn/modules/sales_admin_duplicate_management/sales_admin_duplicate_management_unit_2
  3. https://help.salesforce.com/s/articleView?id=sf.duplicate_rules_standard_rules.htm&type=5
  4. https://help.salesforce.com/s/articleView?id=sf.duplicate_rules_create.htm&type=5
  5. https://help.salesforce.com/s/articleView?id=sf.duplicate_rules_overview.htm&type=5