I'm looking to import a large list of leads but I'm hesitant to due to the fact that some of these leads I'd be importing could very well already be marked as Contacts in the CRM. Is there a way to avoid duplicates based on email address for leads? Thanks.


I can think of four options off the top of my head, there may be more

  1. (a) Write a after insert trigger on Lead that checks for duplicate email versus Contacts and then deletes the Lead (or (b) a before insert trigger that does addError() - depending on your upload tool (Data Loader, Import Wizard - partial successes will be honored)

  2. Export all your Contacts into Excel and do a VLOOKUP of the lead email versus the Contact emails; any matches - delete the rows from Excel before you upload

  3. Look into one of the appexchange Lead and Contact data Quality packages like RingLead

  4. Import all the Leads and then use an anonymous Apex script to run through them, looking for matches against Contacts - then delete all the matches. This may take several passes if the number of Leads is large due to governor limits. If the Leads are imported using a known userId, then finding the ones you imported is straightforward (via createdById and createdDate). This has one advantage over #1 in that you don't have to develop-deploy anything. The disadvantage is you have to know what you are doing to avoid inadvertent database updates. Best not used on orgs that have rigid SDSLC processes.

Be cognizant if you have any automatic workflows/processes/email alerts that you might want to turn off if using approach #1a or #4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.