function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Soundhariyaa MSoundhariyaa M 

How to prevent duplicate records from being created in Salesforce

What is the best way to prevent duplicate records from being created in an object in Salesforce
Best Answer chosen by Soundhariyaa M
ShirishaShirisha (Salesforce Developers) 
Hi Soundhariya,

Greetings!

You can create the duplicate rules to prevent creating the duplicate records.Please refer the below article for the same.

https://help.salesforce.com/articleView?id=duplicate_rules_map_of_reference.htm&type=5

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri

All Answers

ShirishaShirisha (Salesforce Developers) 
Hi Soundhariya,

Greetings!

You can create the duplicate rules to prevent creating the duplicate records.Please refer the below article for the same.

https://help.salesforce.com/articleView?id=duplicate_rules_map_of_reference.htm&type=5

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri
This was selected as the best answer
Soundhariyaa MSoundhariyaa M
Hi Shirisha 

I created Duplicate Rules but according to my requirement this duplicate rules must be accessible only Sys Admin.Is there any ways to do this to duplicate rules or is there any other best way for preventing duplicate records 
Ashish Kumar YadavAshish Kumar Yadav
Hi Soundhariyaa M ,

Best option I recommend to use matching rule and duplicate rules.because of trigger work well but if you have 50k records this impacts scalability and not feasible.if you have less record like 10k then you write the trigger.

1.Write the matching rule and duplicate rule to prevent duplicate records from being created in an object in Salesforce.
2.write the trigger to prevent the duplicate  records from being created in an object in Salesforce.

https://trailhead.salesforce.com/en/content/learn/modules/sales_admin_duplicate_management/sales_admin_duplicate_management_unit_2

https://www.biswajeetsamal.com/blog/avoid-duplicate-record-using-apex-trigger/

Please let me know if you have any queries.

if it is helpful please mark as the best answer.
Malika Pathak 9Malika Pathak 9

Hi Soundhariyaa M,

please find the below link

https://www.salesforce.com/blog/prevent-duplicate-records-blog/

if you find this helpful then mark it as the best answer.