Recycle Bin
The Recycle Bin in Salesforce is the soft-delete staging area where deleted records go before permanent removal.
Definition
The Recycle Bin in Salesforce is the soft-delete staging area where deleted records go before permanent removal. When a user deletes a record (through the UI, Apex DML, or the API), the platform marks the record as deleted but keeps it queryable through SOQL with the ALL ROWS keyword and accessible through the Recycle Bin UI. From the Recycle Bin, the record can be restored to its original state (with relationships and field values intact) or hard-deleted. Records stay in the Recycle Bin for 15 days, after which they are permanently purged.
Recycle Bin exists at two scopes. My Recycle Bin shows records the current user deleted. Org Recycle Bin shows every deleted record in the org, visible to users with the Modify All Data permission. The 15-day retention is a per-org guarantee, and most orgs experience the platform purging older records earlier when the Recycle Bin hits its size cap. The Recycle Bin is the last line of defense against accidental deletes; once a record is purged from the bin, recovery requires a Salesforce Support data restoration request (which is paid and slow).
How the Recycle Bin handles deleted records in Salesforce
How soft-delete actually works
When a record is deleted, the platform sets the IsDeleted field on the row to true rather than removing it. The record continues to occupy storage, falls out of the standard SOQL query results, and appears in the Recycle Bin UI. SOQL queries with the ALL ROWS clause can read deleted records: SELECT Id, Name FROM Account WHERE IsDeleted = true ALL ROWS. This is the recovery path for programmatic access. The soft-delete model means accidental deletes are recoverable for 15 days without escalating to Salesforce Support.
My Recycle Bin vs Org Recycle Bin
Two views exist. My Recycle Bin shows only records the current user deleted. It is accessible from the Recycle Bin tab and the App Launcher. Org Recycle Bin shows every deleted record across the entire org, regardless of who deleted them. Access requires the Modify All Data permission (typically granted to System Administrators). The Org view is the recovery path for an admin investigating a mass-delete incident or restoring records deleted by a now-departed user.
The 15-day retention guarantee
Salesforce guarantees that records stay in the Recycle Bin for at least 15 days from the delete event. After 15 days, records become eligible for permanent purge. The platform also enforces a size cap: 25 times the org's data storage allocation. When the cap is hit, the platform starts purging the oldest records, even if they are inside the 15-day window. Most large orgs hit the size cap before the 15-day cutoff. The implication: relying on 15 days as a hard rescue window is a mistake; treat the bin as a 24-to-48-hour rescue window in practice.
Restoring records and the dependency graph
Restoring a record from the Recycle Bin reinstates the record with its field values, including the original Id (which is permanent on the record), and reattaches relationships. If the parent record is also in the Recycle Bin, the platform either restores both or requires the admin to restore the parent first. For complex parent-child hierarchies (Account -> Contact -> Opportunity -> OpportunityLineItem), the dependency chain matters. The restore order is typically root-first, leaves-last. The Recycle Bin UI surfaces dependency errors when the restore order is wrong.
Permanently emptying the Recycle Bin
Users can permanently delete a record from the Recycle Bin by selecting it and clicking Delete. The platform purges the record from storage and removes it from SOQL ALL ROWS results. Admins can mass-empty the Recycle Bin with Empty Org Recycle Bin (irreversible). This is occasionally used to free up storage when the org is near the storage cap. The action is one-way; once emptied, the records require Salesforce Support data restoration for recovery.
Hard-delete and the DELETE API option
For programmatic deletes that bypass the Recycle Bin entirely, the API supports a hardDelete option on Bulk API operations. A bulk delete with hardDelete = true removes the records without going through the Recycle Bin staging. This is occasionally used for compliance scenarios (GDPR right-to-be-forgotten) where the data must be fully purged immediately. The user needs the Bulk API Hard Delete permission, which is granted carefully because mistakes have no recovery path.
Recycle Bin limits and edge cases
Some records cannot be restored from the Recycle Bin. Users (the User object) cannot be deleted in the first place; they are deactivated instead. CustomMetadataType records, certain platform-managed records, and some system audit records bypass the Recycle Bin. Managed package data deletes also have special handling: uninstalling a managed package can remove the package's data without it appearing in the Recycle Bin. These edge cases catch admins unfamiliar with the platform's deletion semantics.
Recovering records from the Salesforce Recycle Bin
Using the Recycle Bin is straightforward: open it from the App Launcher, select records, click Restore or Delete. The feature works the same way across Lightning Experience and Salesforce Classic.
- Open the Recycle Bin
App Launcher, search Recycle Bin, click the tab. The default view is My Recycle Bin (records the current user deleted).
- Switch to Org Recycle Bin if needed
For admins investigating a mass-delete or recovering records from another user, switch to the Org Recycle Bin view. Requires Modify All Data permission.
- Filter and find the record
Use the filter bar to narrow by object type, deleted date, or text search. The bin can hold tens of thousands of records, so filtering matters.
- Select records and choose action
Select the records to restore or permanently delete. Click Restore to reinstate, or Delete to permanently remove. For dependency chains, start with the root parent.
- Verify the restored record
Open the restored record. Confirm field values, relationships, and the record Id match the original. Sharing rules and field history apply as expected; the record is now indistinguishable from a never-deleted record.
- Empty the Recycle Bin if storage is tight
For admins managing storage limits, Empty Org Recycle Bin permanently removes everything in the bin. The action is one-way and should be coordinated with the team.
View of records the current user deleted. Default for non-admin users.
View of every deleted record in the org. Requires Modify All Data permission.
Reinstates the record with field values, relationships, and Id intact.
One-way removal that purges the record from storage and SOQL ALL ROWS results.
Admin action that permanently removes every record in the org bin. Frees storage.
Programmatic delete option that bypasses the Recycle Bin entirely. Used for compliance scenarios.
- The 15-day retention is a minimum guarantee, not a maximum. The platform purges older records when the size cap (25x data storage) is hit. Treat the bin as a 24-48 hour rescue window in practice.
- Restoring records with deleted parents requires the parents to be restored first. The dependency chain matters; start with the root parent and work outward.
- Bulk API Hard Delete bypasses the Recycle Bin entirely. The permission should be granted carefully; mistakes have no recovery path inside Salesforce.
- Users are deactivated, not deleted. The Recycle Bin does not contain deleted User records because the platform does not allow user deletes.
- Managed package uninstalls can remove data without it appearing in the Recycle Bin. Confirm the data retention strategy before uninstalling a package with customer data.
Trust & references
Straight from the source - Salesforce's reference material on Recycle Bin.
- Recycle Bin OverviewSalesforce Help
- Bulk API Hard DeleteSalesforce Developers
- SOQL with ALL ROWSSalesforce Developers
About the Author
Dipojjal Chakrabarti is a B2C Solution Architect with 29 Salesforce certifications and over 13 years in the Salesforce ecosystem. He runs salesforcedictionary.com to help admins, developers, architects, and cert/interview candidates sharpen their fundamentals. More about Dipojjal.
Test your knowledge
Q1. What is the Recycle Bin?
Q2. How long are records kept?
Q3. What's the capacity?
Discussion
Loading discussion…