Managing Duplicates Records with Duplicate Rules
Prevent duplicate names and provide custom error messages using duplicate rules
https://www.youtube.com/watch?v=uPT4wWOl9vs
Step 1: Creating MATCHING RULES:
Setup--> Data.com Administration -->Duplicate Management -->Matching Rules (Click) -->New -->Select the object --> Rule Name: "Unique Name matching rule" (of whatever it suites your needs) --> Field: Name --> Matching Method: Exact -->Save/Activate
Step 2: Creating DUPLICATE RULES:
Setup–> Data.com Administration
-->Duplicate Management -->Duplicate Rules (Click) -->New Rule -->Select the object -->Rule Name: "Unique Name" (of whatever it suites your needs) -->Record-Level Security: Enforce sharing rules -->Action on Create/Edit: Block -->Compare Merchants With: <select your object> -->Matching Rule: select the matching rules you have created in the STEP 1 -->Save/Activate
Adding delete confirmation in Visualforce page Using Aggregate Functions