I came to a recent scenario where i have 10,000 existing leads in my lead object. I want to delete the existing duplicate leads which have duplicate emails in my lead object. So that the anonymous emails cant be sent . i have wrote a trigger but its not working. Help me out.

  • Trigger is not the solution for this but what's your trigger it may help us in understanding how are you identifying duplicate leads
    – Jarvis
    Feb 20, 2015 at 7:31
  • @Bennie i wrote a trigger but when we create a new lead then it prevent from duplicate. but i want to check for the existing records. Feb 20, 2015 at 7:33
  • You have to use appexchange products for this maybe DemandTools doing it using apex is also a manual task depending on the criteria.
    – Jarvis
    Feb 20, 2015 at 8:08

1 Answer 1


You can use the Mass Delete functionality to undo any imports.

Follow this link or below provided steps

  1. Click Your Name | Setup | Data Management | Mass Delete Records.
  2. Click the link for the type of record to delete.
  3. Review the information that will be deleted along with the records.
  4. Specify conditions that the selected items must match, for example, “State equals California.” For more information, seeEntering Filter Criteria.
  5. When deleting accounts, check the appropriate boxes if you want to delete accounts with attached closed/won opportunities or attached opportunities owned by other users.
  6. When deleting products, check Archive Products... if you want to include products that are on opportunities. Archived products are not moved to the Recycle Bin. Check this option to:

    • Delete products that are not on opportunities and move them to the Recycle Bin.
    • Archive products that are on opportunities. These products are not moved to the Recycle Bin and cannot be recovered.

Leave this box unchecked to delete only those products that are not on opportunities. Selected products that are on opportunities will remain checked after the deletion to indicate they were not included in the deletion.

  1. Choose Search to find records that match.
  2. Select the box next to the items you want to delete. Optionally, check the box in the column header to select all currently displayed items.
  3. To permanently delete records, select Permanently delete the selected records. Please note that selecting this option prevents you from recovering the selected records from the Recycle Bin.
  4. Click Delete. If you did not select Permanently delete the selected records, deleted items are moved to the Recycle Bin.

You can use 3rd party tools for removing duplicates, refer this thread for more details.

  • sir i know this Mass Delete Functionality but my question is that it is not possible through controller? Feb 20, 2015 at 9:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .