I need to be able to delete all the test records submitted on a custom object in my production org. However I am not sure how to do so. I am a system admin so I should have all the relevant permissions.

  • 3
    how many records are you trying to delete? what have you tried to delete them?
    – glls
    Dec 18, 2017 at 16:38
  • 1
    Are you able to identify the test records through a naming convention or a field set on the record? If not, you're going to have to guess based on some value (usually dates), just delete everything and start over, or go over each record manually. Next time, keep test data in the sandbox, or make it very clear what is test data. Dec 18, 2017 at 21:03

2 Answers 2


The earlier answer about using apex in the developer console is good and easier than what I say below. However, if you don't feel comfortable in writing a SOQL or can't in this case and need manual review of the records or some other complication, wanted to point out this other option:

Using Salesforce data loader

Step 1: Export the object you want to delete from. You can literally just download the whole object, all rows. A tailored SOQL would save you on the next step, but you can just download all rows. Then save that to a CSV file.

Step 2: Review the CSV file in Excel and manually figure out what you wanted to keep or delete. You can even have your users review this file. Narrow down to just what you wanted to delete. In the end, have a CSV file of ids to delete.

Step 3: Use Data Loader delete of the CSV file.


If you can identify the 'Test Records' then you can delete them using the developer console.

Rather than reposting, the below question and answer provide a decent explanation how to do this. Developer Console - Delete Multiple Records

You would want to tweak the SOQL statement to only delete the records you want to delete. For example delete Contact records that are owned by your user (if you have only ever created test records).

You must log in to answer this question.

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