function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rony57Rony57 

Can I programmatically delete existing duplicate Leads in my lead object?

Hello All,
            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.
Best Answer chosen by Rony57
Gaurav KheterpalGaurav Kheterpal
You can use the Mass Delete functionality to undo any imports.

Follow this (https://success.salesforce.com/answers?id=90630000000gx2RAAQ) 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:
    1. Delete products that are not on opportunities and move them to the Recycle Bin.
    2. 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.

       7. Choose Search to find records that match.
       8. 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.
       9. 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.
      10. 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 (http://salesforce.stackexchange.com/questions/54163/deduping-existng-leads-and-contacts) thread for more details.

If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Salesforce Mobile Evangelist| Developer Forums Moderator| Dreamforce Speaker


 

All Answers

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

Follow this (https://success.salesforce.com/answers?id=90630000000gx2RAAQ) 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:
    1. Delete products that are not on opportunities and move them to the Recycle Bin.
    2. 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.

       7. Choose Search to find records that match.
       8. 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.
       9. 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.
      10. 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 (http://salesforce.stackexchange.com/questions/54163/deduping-existng-leads-and-contacts) thread for more details.

If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Salesforce Mobile Evangelist| Developer Forums Moderator| Dreamforce Speaker


 
This was selected as the best answer
Rony57Rony57
@gaurav sir if i go for a controller then is it possible to do that...
khushboo verma 12khushboo verma 12
Hi Rony57,

Have got any solution.  please share with us. I have also the same requirement in  my project.