A Complete Guide to Understanding Duplicate Rules and Matching Rules in Salesforce
In any CRM system, maintaining clean and accurate data is crucial for success. In Salesforce, Duplicate Rules and Matching Rules play a key role in ensuring that records, such as Leads, Contacts, and Accounts, are not duplicated. These tools help maintain data integrity by identifying and preventing duplicates before they are created or when they are edited. In this blog, we’ll explore what Duplicate Rules and Matching Rules are, how they work, and how to configure them to improve data quality in your Salesforce organization.
Thank you for reading this post, don't forget to subscribe!What Are Matching Rules in Salesforce?
Matching Rules are the logic behind identifying potential duplicates. They define the criteria or fields that Salesforce should use to compare records for duplication. For example, a matching rule for Contacts may compare the email address and phone number fields to detect duplicate records. These rules can be based on a variety of fields, including standard fields like name, email, phone, and custom fields that are relevant to your business needs.
How to Create a Matching Rule
- Navigate to Setup → Search for Matching Rules.
- Click New Rule

- Select the object (Lead, Contact, etc.).

- Define the matching criteria by selecting fields and match methods (Exact, Fuzzy, etc.).

Types of Matching Criteria:
- Exact Match: Requires an exact match of the specified fields between two records.
- Fuzzy Match: Allows a slight variation in values to still be considered a match, making it useful for detecting duplicates where the data might be entered differently (e.g., typos, abbreviations).
- Save and activate the rule.

What Are Duplicate Rules in Salesforce?
Duplicate Rules in Salesforce are designed to manage how duplicates are handled within the platform. They define the actions that Salesforce should take when a potential duplicate is detected. Duplicate Rules work with Matching Rules to identify potential duplicates based on certain criteria. The rules then dictate what should happen when duplicates are found, such as blocking the creation of a new record or allowing the user to review the potential duplicates before proceeding.
How to Create a Duplicate Rule
- Navigate to Setup → Search for Duplicate Rules.
- Click New Rule and select the object (Lead, Contact, etc.).

- Fill in the Form

Rule Details
This section defines the basic information for your duplicate rule.
- Rule Name:
Enter a descriptive name for the rule - Description:
Add details about the purpose of this rule. Helps other admins understand its function. - Object:
Shows the Salesforce object this rule applies to. - Record-Level Security:
Determines which records are checked for duplicates.- Enforce sharing rules: Only checks records the user has access to.
- Bypass sharing rules: Checks all records, ignoring user access.

Actions
This section defines what happens when a duplicate is detected during create or edit.
- Action on Create:
- Allow – Lets the user save the record but can show an alert or report.
- Block – Prevents the user from saving the record.
- Alert Checkbox – Shows a warning message when a duplicate is detected.
- Report Checkbox – Logs the duplicate for reporting purposes.
- Action on Edit:
Works the same as “Action on Create,” but applies when editing an existing record. - Alert Text:
Customize the message shown when a duplicate is detected.

Matching Rules
This section defines how Salesforce identifies duplicates.
- Compare Accounts With:
The object to compare against. Usually the same as the object selected above - Matching Rule:
Choose an existing matching rule that defines which fields and logic are used to detect duplicates. - Matching Criteria / Field Mapping:
Shows the specific field mappings that the rule uses. Click Mapping Selected to view or edit.

Conditions (Optional)
This section lets you apply the duplicate rule only under certain conditions.
- Field – Choose a field to filter which records the rule applies to
- Operator – Defines the comparison operator
- Value – The value to compare against (e.g., Active, Web Form).
- Add Filter Logic – Allows combining multiple conditions with AND / OR logic.

- Save and Activate the Rule.
Press the activate button to enable the duplicate rule.

How Duplicate and Matching Rules Work Together
- Matching Rules define how Salesforce identifies duplicate records by comparing field values.
- Duplicate Rules determine what action Salesforce should take when a duplicate is found.
Example Scenarios:
Scenario 1: Blocking Duplicates
- In the Duplicate Rule settings, the Block option is selected for both record creation and editing.
- If a user tries to create a Contact with the same First Name, Last Name, and Email as an existing record, Salesforce displays an error message preventing the duplicate from being saved.

- A View Duplicates link allows users to review existing similar records.

Scenario 2: Allowing Duplicates with Alerts and Reports
- The Allow option is selected, with Alert.
- When a user creates a duplicate record, Salesforce shows a warning message indicating similar records exist.

- Clicking the View Duplicates link allows users to review existing similar records.

- The Allow option is selected, with Report.
- When a user creates a duplicate record, Salesforce automatically logs it in a Duplicate Record Set for reporting purposes.
- To review the duplicate records:
Navigate to Duplicate Record Sets to view the reported duplicates.


Managing and Merging Duplicate Records
- Viewing Duplicate Records:
- In a Contact’s related list, the Potential Duplicates section shows duplicate records.

- Clicking View Duplicates displays a list of duplicate Contacts.

- Merging Duplicate Records:
- Users can select up to three records to merge at a time.
- During merging, users can choose the field values they want to keep in the final record.

Conclusion
Duplicate Rules and Matching Rules are essential tools for maintaining clean, reliable data in Salesforce. By configuring and fine-tuning these rules, you can prevent the creation of duplicate records and ensure your team has access to accurate, up-to-date information. Whether you’re preventing duplicate Leads, Contacts, or Accounts, these features help keep your Salesforce data organized, improve user efficiency, and support better decision-making. By following best practices and regularly reviewing your rules, you can enhance data quality and optimize the performance of your Salesforce instance.
