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

Is there a way to hard-delete objects?

Hi there,
for a client we have developed a script that deletes objects quite frequently. Now someone from Salesforce just called and told us, the recycle bin of that clients Salesforce was totally clogged by all the deleted objects - they had to kind of flush the thing manually.
Now I checked the API docs and judging from what I've read, all delete calls will just move the objects into the recycle bin - to make sure they can be undeleted later.
Is there any way to force a hard delete using the API, avoiding the recycle bin? Or is there any function to empty the recycle bin maybe?
Just hold down the "Shift" key while you run your script.

:-) Steve.

I make joke...  Dank you, I be here all de veek!

But, seriously, the only documentation I've *ever* seen about the garbage collection is:

A background process that runs every two hours purges records that have been in an organization's recycle bin for more than two hours if the number of records is above a certain limit. Starting with the older records, the process purges recycle bin entries until the recycle bin is back below the limit. This is done to protect Salesforce against massive recycle bins. The limit is calculated using this formula:
    5000 * number of licenses in the organization

For example, an organization with 1,000 licenses could have up to 5,000,000 (five million) records in the recycle bin before any purging took place. If purging has been performed before your getDeleted call is executed, an INVALID_REPLICATION_DATE error is returned. If you get this exception, you should do a full pull of the table. If you regularly delete large numbers of records, your data replication should run more frequently than every two hours to ensure all records are returned by getDeleted.

I also remembered something from last year, and went looking for it.  The thread:

However I haven't looked at trying that myself as I haven't needed it, etc.

Good luck, Steve.
thank you for the information provided.
Incidentally, there is now an API verb called emptyRecycleBin that allows you to hard-delete objects.