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
QMEQME 

Mass Delete Records: Custom Object

Is there any way to mass delete records in a custom object (table)?  The Mass Delete feature under Setup -> Administration Setup -> Data Management -> Mass Delete Records  only seems to perform a mass delete for SDFC standard objects....

 

It is pretty painful to delete records one by one - phew!!

 

 

WmWm
You can pull out a report for all the records to be deleted along with the Salesforce Id, then use the data loader to mass delete the records from any object.
CopyPasteGhostCopyPasteGhost
is it possible to provide a little more detail on how to create a report. Also some details about how to use the data loader and where that can be found...Sorry for the newbier question....first day ;)
CopyPasteGhostCopyPasteGhost

Follow up:

 

The data loader can be download directly off your account pages:

 

Setup->Data Managment - >download the data Loader and then click the link to download the data loader.

 

Once you are there you can install the loader.

 

Once the loader is installed you can then chose a crud method to run. In this case I want to delete a bunch of records therefore I will choose delete.

 

then you pick the custom object you want to purge,

and select a CSV file

 

 

This is where I'm stuck. what is the CSV file I need to provide. I've tried to run reports and export CSV files containing, only the id, all the records...I've tried it all expect the right way :)

 

Any help would be awesome!

 

Thanks

CPG

 

agulli1agulli1
First you must export all of the records from Data Loader using only the ID when mapping the file.  Then once the export CSV is made you can go back to the Data Loader and choose the delete option.  When you get to the point where you choose a CSV to complete the task, pick the export file you created earlier.  Then map the ID to the ID. And that should delete all the records.
ProgrammerProgrammer

These workarounds are rediculous... When is SalesForce going to implement these basic features...

justinreesejustinreese

That worked perfectly!  Thanks aqulli1!

Shahin__cShahin__c

This doesn't seem to work with a sandbox....

SkiesnPiesSkiesnPies

There is an alternative (and quicker) way, if you use Eclipse to do your development, there is an "execute anonymous" feature which allows you to fire off a bit of APEX code, this APEX code can be a SOQL statement which gets all your custom objects together and then zaps them on mass. 

 

list<mycustomobject__c> DeleteList = [select Name from mycustomobject__c  limit 5000]; 

delete DeleteList;

 

I have put the limit in there as you may have governor limits on how many objects you can retreive / zap. You can obviously edit the SOQL to only include certain records - my example deletes the 1st 5,000 records of that object, regardless of what they are. 

 

It goes without saying that you should be EXTREMELY careful with this kind of code!!! 

salmanmanekiasalmanmanekia

Tried the one with the data loader but it complians of Invalid id ...

DeJayDeJay
Is this work around out of date?

I need to do the same thing but I can't find any "Data Loader" on the "salesforce/setup/Setup?setupid=DataManagement" page