One of the most obvious gaps in the ‘out-of-the-box’ salesforce.com toolkit is a duplicate blocker. There’s a free force.com labs duplicate blocker available on the app exchange , but it only finds duplicates with matching first name, last name & email address. That’s not always enough – especially since most of your contacts will have more than one possible email address.
My buddy Steve Caldwell and I came up with a simple work around that takes about 5 minutes to implement and doesn’t cost a dime. Rest assured, your org will still find a way to enter duplicate contacts, they always do, but this should help save some of your time and sanity.
1. Create A Unique ID Field
Create a text field (allow about 20 characters) and name it Unique ID. Make it read-only and don’t add it to any page layouts. Be sure you mark the field as a Unique ID field.
2. Create a Workflow
Now create a workflow that runs anytime a contact is created or edited. Assign a Field Update action to that workflow that combines the First Name and Last Name into one string in the Unique ID field. (John Smith unique id = johnsmith).
3. Update All Contacts
You’ll want to run the rule once to a. populate all the Unique ID fields and b. pull a list of existing duplicates. If you use the Apex Data Loader, this is really easy to do. Simply run a report that includes all of your contacts. You’ll only need to include the Contact ID column in this report. Then turn around and run an update through the Data Loader using that same list. Wa-lah! You’ve just updated all your contacts to have a Unique ID and your error report contains a list of existing duplicates you can go clean up.
4. Salesforce Administrator Triumphs
The next time a user tries to create a contact with the same first and last name as an existing contact, they’ll receive an error message that the Unique ID already exists and won’t be able to save.
This little trick should work for most objects you need to prevent dups on (leads, opportunities, custom objects, etc). If you run into multiple contacts with the same name, you may need to do something a bit more sophisticated or check the App Exchange for some paid solutions.