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

Mass deleting custom object data

How is everyone purging custom object data? 


Please correct me if I'm wrong about these assumptions:

  1. There are no Admin features for mass deleting custom object data.
  2. There isn't a check many items and hit one delete button kind of option for users.
  3. In Apex coding, you have to query records before you can delete them either with delete xyz or Database.Delete.  In other words, you have to do query first instead of executing a DELETE FROM xyz. 
  4. Your unit tests can only query a total of 500 rows from custom objects (seems higher on Account, but still not high enough for a large company with over 5000 customers.)  

Please correct or affirm any assumption, or provide info helping me understand our options.  Right now, I don't understand how you can realistically mass delete custom object data. 



That's correct Erik!

Maybe, you can have a look at Batch Apex for such kind of functionality. It helps you do mass operations on objects in salesforce database. Additionally, with Apex Schedular, you can schedule this process as well.

Apart from this, you can delete the data manualy/batch mode using Apex Data loader.





I also am in the same situation I need to delete 5000 records from my custom object. how can I use batch apex to do this. an example would be great. Note: I don't really care if it's batch apex...I just want to delete records.