Hello Trailblazers!
In the area of Salesforce data management, maintaining data accuracy and integrity is paramount. Duplicate records not only clutter databases but also lead to inefficiencies in sales, marketing, and customer service processes. To address this challenge, Salesforce offers Duplicate Rules, a powerful feature designed to identify and prevent the creation of duplicate records.
To create the duplicate rule, we’ll require the matching rule. So, if you would like to know what is Matching Rule and how to create it, then you can go with this link.
In this blog, we’ll explore the significance of Duplicate Rules, their implementation, and best practices for maximizing their effectiveness.
So let’s get started!
What is a Duplicate Rule?
Duplicate Rules in Salesforce are a set of criteria that define when a new record is considered a duplicate of an existing record. These rules help organizations enforce data quality standards by identifying potential duplicates in real time during data entry or import processes. By preventing the creation of duplicate records, Duplicate Rules ensure a clean and reliable database.
How to Create Duplicate Rules?
Here we’ll create a duplicate rule on the Employee object to ensure that duplicate employee records should not created.
To create the duplicate rule, follow the below steps:
- Go to the Setup.
- Enter Duplicate Rules in the Quick Find box.
- Click Duplicate Rules under Duplicate Management.
- It’ll take you to the Duplicate Rules page where Standard Duplicate rules for Account, Contact, and Lead Objects are already created as shown in the figure below.
- Click on the “New Rule” as shown above.
- Select the “Employee” object.
- Define the Rule name.
- In the Record Level Security, select the “Enforce Sharing Rules”.
The difference between the Enforce Sharing and Bypass Sharing rules is, that when you enforce sharing rules, the matching rule only considers records that the user has access to, whereas when bypassing sharing rules, all records are evaluated without any access restrictions. - In the actions, Set the actions that should be taken when a user creates or edits a duplicate record. When you choose alert, provide a suitable alert message explaining why the user is unable to save the information and what the next step is.
See the figure below.
- In the Matching rules section, the object will be there – already selected.
- Then, click on the dropdown and select the desired matching rule. Here I’m selecting the matching rule that we created in the previous blog. If you do not know how to create a matching rule, then you can go with this link.
- By clicking on “Add Rule” button, you can also add multiple matching rules.
- If the rule requires any conditions to be met, then you can define those criteria. This is optional.
- Click Save.
- Click Activate.
With this simple steps, you can create a duplicate rule for any object.
Now it’s time to test the Duplicate rule and Matching rule that we’ve created so far.
Testing the Duplicate Rule:
- To test the rule, create a record that matches the field of the existing record. Here, we create a new employee record whose “Email” field matches the existing employee record.
- So, it will give an “Alert Message” that this record is a potential duplicate.
- Click “View Duplicate” to see the duplicate records as shown above.
- You can see it has one duplicate record.
But, if you ignore this, you can still save the record even if it is a duplicate.
How to Prevent Users from Saving Duplicate Records?
To prevent users from saving duplicate records, you need to block the permission/action. So, to achieve this, follow the instructions below.
- Open the Duplicate rule that you created.
- Click Edit.
- Under the Actions, select “Block” when Create and Edit Action. This will restrict the user from saving the record if the duplicate is found.
- Click Save.
Your rule will look like this.
Conclusion:
Duplicate Rules in Salesforce are a vital tool for maintaining data quality and preventing the proliferation of duplicate records. In this way, you can create a duplicate rule and specify the actions like Allow or Block to allow and block the user from saving the duplicate records.
Happy Reading!!