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

Automating empty of the recycle bin


We are a new SalesForce customer. We'll have a need to refresh data in SalesForce from our
backend system on a nightly basis. I plan on using the command line interface of the DataLoader
to delete and import this data.

I've read that the recycle bin is capable of containing 5000 deletes, I forsee this being an
issue during this nightly refresh of information.

Do you know of a way in which I can empty the recycle bin remotely and/or on-schedule?

Thanks in advance for your help,

Why not just update the data vs deleting and reloading?

How much data are you thinking about?
You should look into using the new upsert() method in the API. You just need to mark/create a field as an external ID on whatever objects you're refreshing nightly and then you can upsert them instead of re-inserting them. You'll also have to have another process that pulls back all external ID's on SFDC and delete the ones that were removed from whatever your local source was.

If you really must delete and re-insert and empty the recycle bin the easiest way would be to create a simple application that logs you into SFDC and then calls: /setup/own/undeleter.jsp?empty=1
Thanks for your response Benji. I believe that you are correct - updating would be much more efficient that deleting and reloading the data.

This point became extremely evident once I looked at the number of rows that need to be added.

Thanks again,

Thanks EJ - I appreciate your response.

"upsert" definitely sounds like the way to go. The number of rows that we need to reload nightly probably will not allow the delete/reload approach. Thanks for the heads-up on pulling the external ID's back from SFDC.