How to restrict user to create multiple records (One record per user scenario) using Duplicate rule?

Published by

on


This can be achieved by different solutions. Like,

  • Validation rule
  • Duplicate rule
  • Trigger

In this use-case, we will see how to achieve this using a simple Duplicate rule.

1st I have created a custom object called ‘Passbook’ and added below custom fields and marked as ‘Required’.

  • Customer Mobile Number
  • Customer Email

For this use-case I am going to use Customer email and phone number to check if any other record is present. You can define as per your business requirement or post your specific scenario and I will try to find a solution for your scenario.

Then set the OWD of the object to Private and uncheck the grand access using hierarchy (this way we can fully control over who can access whose record using custom sharing rule).

Setup -> Sharing Settings -> Edit – Organization Wide Default -> Scroll to ‘Passbook’ object and set the default accesses to Private and untick the ‘Grant Access Using Hierarchies’ checkbox.

Now create a matching rule. In matching rule you will define the logic to check if already a record is present with the help of a unique key (for our use-case the unique key is customer’s email and phone number).

Go to Setup -> Search for ‘Matching Rules’ – > New rule -> Select Passbook as object -> Enter the details as below screen shot -> Save  -> Activate

This slideshow requires JavaScript.

Now let’s setup Duplicate rule.

Go to Setup – > Search for ‘Duplicate Rules’ -> New rule – Passbook ->Enter the details as below screen shot -> Save  -> Activate

This slideshow requires JavaScript.

Let’s test now,

I have created a Passbook record for a customer using Mobile and Email. Then tried again creating with same information. And duplicate rule stopped me creating a duplicate record and also gave an option see my existing record. PFB the screen shots.

This slideshow requires JavaScript.