Salesforce Asked by Uri Lukach on November 28, 2021
Is there a DML or other way to delete all records from the developer console? For example, we have 100K Leads in our testing environment and we would like to delete all of them in one operation.
Is that possible?
By the way, I saw there is a mass delete option, although it only lets you delete a few hundreds records at a time…. (using Setup-> Administration Setup->Data Management -> Mass Delete Records.)
I have made an open source GitHub project for deleting multiple records in batches. you can go through the project and embrace the functionalities as per your requirements. Github Repo : https://github.com/vipul-goyal/Salesforce-Batch-To-Delete-Records
Answered by Vipul Goyal on November 28, 2021
To delete more than 50,000 records, you can use the DataLoader program. Follow these steps...
-Open the data loader and choose "export". Navigate to your object and select it, then choose the 'id' field. You only need the 'id' for each record in order to delete it. Export this to a csv file.
-Open the data loader again and choose "delete". Navigate to your object and select it. Then import the csv file you have just saved containing the IDs for all your records. Import that and map the 'id' field to that of your object.
Answered by Erich Purpur on November 28, 2021
2 ways,
Answered by Pradeepkumar'2552866 on November 28, 2021
One way to delete using Developer Console is to first execute your query
SELECT Id from My_Custom_Object__c
Then highlight all the result rows and click on the Delete Row button at the bottom.
Answered by Bhavana on November 28, 2021
I add something to your answers. There are two ways to solve this problem, in addition to the console. I think that the console could be very useful, but maybe in production one wants to have an higher "control" on the data. In that case there are two ways.
1) Use the Workbench:
This file can now be used to delete those records from the org:
1) Use the Data Loader:
Setup - Data Management - Data Loader
Answered by Andrea Ianni ௫ on November 28, 2021
Using Apex Data Loader to delete records:
First, you have to export all the records (the ID will be sufficient) to a csv file. Then you can delete all the records based on that csv file. When you perform the delete make sure you map the ID column of the csv file to the Id column of the object.
This way took me a few minutes to delete 120K records (Lead).
Answered by Uri Lukach on November 28, 2021
You can delete records from the developer console with the line
delete [SELECT Id FROM MyObject];
However, this isn't going to delete 100k records successfully due to governor limits. You're going to need to use dataloader to export the 100k records, then use the export to delete the records.
Edit: Better than that, you can use LIMIT to select a subset, and then rerun the command after each execution
delete [SELECT Id FROM MyObject LIMIT 10000];
Answered by Phil Rymek on November 28, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP