+ Start a Discussion
Esther Thacker 6Esther Thacker 6 

Duplicate Contacts/Accounts

I am still fairly new to using Salesforce and only have been working as an admin for a couple months. So I have a question that maybe someone with more experience can answer.

A few of the users on Salesforce have been reporting duplicate Contacts and Accounts on the system. They asked me to look into it to see if there is something in the system that is triggering the creation of the duplicate contacts. From my training I know that things like Workflows and Triggers can cause the creation of records and other data on the org so I looked around the org to see if the previous admin had put in anything that would cause a duplicate to be created. I didn't find anything. Is there anything else that I should be checking that has the ability to create duplicate records that the past admin might have set up?

Now, I am thinking that the users are just being careless and not checking to make sure that a contact or account has been created already. Because the one of the accounts/contacts that are being "duplicated" is a couple years older, while the other one is a new one that they created recently and then noticed that a duplicate had been made (or just realized was already in the system). As well as the duplicates were created by different users. If there was a trigger or something that was creating duplicates they should have the same creation date and been created by the same user, correct? So with that information it sounds like they are accidentally creating duplicate records themselves right? 

These duplicates also don't happen everytime a new account or new contact is created.

And the last question, is there something that I can do to ensure that duplicate records aren't created? I know when I researched it said that Salesforce allows the creation of duplicate records and I can see the reasoning behind this, but is there anything that I as an admin can do to ensure my users aren't being careless and creating duplicate records?

Thank you for any help,

Roshni RahulRoshni Rahul
Hi Esther,

There are different ways by which you can avoid duplicate records from saving.

1. You can use an app from appExchange called DupeCatcher which is free.

2. You can prevent saving duplicate records using trigger

trigger trgr_Account_DuplicateCheck on Account (before Insert, before Update) {
    Map<String, Id> mapAccount = new Map<String, Id>();
    Set<String> setAccName = new Set<String>();
    for(Account acc : trigger.new)
        Account acc :
            SELECT Id, Name
            FROM   Account
            WHERE  Name IN :setAccName
        mapAccount.put(acc.Name, acc.Id);
    for(Account acc : trigger.new)
            mapAccount.containsKey(acc.Name) &&
            mapAccount.get(acc.Name) != acc.Id
                'There is already another Account with the same Name. ' + 
                'Refer: <a href=\'/' + 
                mapAccount.get(acc.Name) + '\'>' + 
                acc.Name + '</a>',
3. By using Matching rules and Duplicate rules.

Hope its helpful.