+ Start a Discussion

How Can I Delete All Data in a Custom Object?

I have a custom object "Projects", which I imported data into.  The requirements have changed regarding the unique identifier data, so I need to delete the imported records and import new records.  How can I delete all of the data in the custom object?  I don't want to delete the entire "Projects" object because I have defined a lot of custom fields and do not want to lose that work.  I just want to delete all the records in that object.

Thanks so much!
Joanna -

When I have faced the same task, I simply used Data Loader to do an export of the IDs from the object, and then used that file with Data Loader to delete the rows.  Others may have better ideas, but this was easy and fairly fast for my 2K of records.

Hope this helps.

Rick has the right pattern, whether you use dataloader or your own mini app, you need to fetch all the ids for the object you want to purge, then, in batches, run the delete call passing in ids.

Thanks.  That was very helpful.