Recycle Bin in Salesforce

Salesforce Recycle Bin: The Recycle Bin in Salesforce is a feature that acts as a safety net for deleted records. When a user deletes a record in Salesforce, whether intentionally or accidentally, it is not immediately erased from the system. Instead, the deleted record is moved to the Recycle Bin, where it can be restored if needed.

The Recycle Bin provides a way to recover deleted data, ensuring that important data is not permanently lost. It is especially useful in cases where a record was deleted by mistake or if there is a need to retrieve data that was deleted at an earlier time.

Within the Recycle Bin, users can view a list of deleted records, organized by object type. The Recycle Bin retains deleted records for a specific period of time, usually 15 days, depending on the organization’s settings. During this time, users have the option to restore the deleted records back into their Salesforce instance.

It’s important to note that the Recycle Bin operates on a per-user basis. This means that each user can only see and restore the records they deleted themselves, unless they have the “Modify All Data” permission, which allows them to view and restore records deleted by other users as well.

However, once the retention period for deleted records in the Recycle Bin expires, or if a user chooses to manually purge the records, they are permanently removed from the system and cannot be recovered. Therefore, it’s essential to exercise caution and carefully review deleted records before purging them from the Recycle Bin.

Overall, the Recycle Bin in Salesforce provides users with a safety mechanism to retrieve deleted records, minimizing the risk of data loss and supporting data recovery processes within the platform

  • Deleted records are not immediately erased but moved to the Recycle Bin.
  • Users can access a list of deleted records categorized by object type.
  • Recycle Bin retains deleted records for a set duration, typically 15 days.
  • “Modify All Data” permission allows users to view and restore records deleted by others.
  • Deleted records are permanently removed once the retention period expires or manually purged.

How to Access Recycle Bin in Salesforce ?

If you use Salesforce and accidentally delete important records, don’t worry! In this post, I will guide you through accessing the recycle bin in Salesforce. However, remember that certain permissions must be enabled to perform specific actions. Let’s dive in!

Step 1: Checking Permissions:

Before accessing the recycle bin, ensure that you have the necessary permissions. Here’s what you’ll need:

  • Read permissions: To view and recover your own deleted records.
  • Modify All Data: To view and recover records deleted by other users.
  • Tag Manager Permission: If you wish to recover deleted public tags.
  • Modify All Data: To purge the recycle bin.

Step 2: Navigating to the Recycle Bin:

To access the recycle bin, follow these simple steps:

  1. Select the app launcher menu.
  2. Use the search function to find “Recycle Bin.”
  3. When it appears in the search menu, click on it.

Step 3: Viewing and Recovering Deleted Records:

Once you’re in the recycle bin, you’ll see a list of recently deleted items. Here’s what you can do:

  • If you have the Modify All Data permission, you can select “Org Recycle Bin” to view all deleted data in your organization.
  • If the items have been in the recycle bin for less than 15 days, you can choose to restore them.
  • If you want to permanently remove items, you can manually purge them. Remember, purged items cannot be recovered.

Accessing the recycle bin in Salesforce is a simple process that allows you to restore deleted records. By following the steps outlined in this post, you can efficiently recover your own deleted records or even those deleted by other users, provided you have the necessary permissions. Remember to use caution when purging items, as they cannot be recovered once they are permanently removed. 

How to Query Deleted records in Salesforce using ALL ROWS

To query deleted or archived records in Salesforce without using external tools like Data Loader or Workbench, you can leverage the power of Anonymous Apex. Simply follow these steps:

  1. Open the Developer Console in Salesforce.
  2. Navigate to the “Anonymous Apex” tab.
  3. Enter the following code snippet in the editor to retrieve deleted records using the ALL ROWS keywords:

Note: You can not run the below query in Query editor, it has to be done through Anonymous Apex in Developer console

List<Opportunity> allOpps = [SELECT ID FROM Opportunity ALL ROWS]; System.debug(allOpps.size());

If you are interested to query only the deleted records, here is the query: 

List<Opportunity> allOpps = [SELECT ID FROM Opportunity where isDeleted=true ALL ROWS];

Undelete the deleted records within the retention period: 

If you are looking to undelete the records from the recycle bin, you can use UNDELETE

Here is an example:

List<Opportunity> opprecords=[select id from opportunity where isDeleted=true ALL ROWS];
undelete opprecords;
System.debug('number of  opportunities '+opprecords.size());

How to increase the retention period of the recycle bin from 15 days to 30 Days in Salesforce?

Enable ‘Extended Recycle Bin Retention’ Feature

To activate the ‘Extended Recycle Bin Retention’ feature in, follow these steps:

  1. Ask your System Administrator to log a case with Salesforce
  2. Provide the necessary details and request the activation of the ‘Extended Recycle Bin Retention’ feature.
  3. Salesforce Support will review the case and take appropriate action to enable the feature.

Please note the following details about the feature:

  • Once activated, the Recycle Bin retention period will automatically extend to 30 days.
  • The extended retention period of 30 days is only applicable in Salesforce Classic, accessible from the Home page or the Recycle Bin.
  • If you are using the Lightning Experience interface, you may need to switch to Classic mode to access deleted records beyond the default 15-day retention period.

By following these steps and having the feature enabled, you can benefit from an extended Recycle Bin retention period, giving you more time to restore deleted records in Salesforce Classic.

Enjoy using the salesforce recycle bin feature to maintain data integrity and a smooth Salesforce experience!


Recent Posts