Print this page

How to restore multiple records that are in recycle bin

Knowledge Article Number 000002845

It may be necessary to mass restore a large number of records that were incorrectly moved to the recycle bin. Since there is no "restore all" button in recycle bin it may not be scalable to manually undelete the records from the recycle bin.


For API Enabled Orgs (Enterprise Edition and above by default) a potential solution to mass restore records is by leveraging Workbench.

Salesforce does not provide support for Workbench or Excel features or functionality and can't perform data management or manipulation tasks on a customer's behalf. The following information is provided as a courtesy and to serve as general guidelines for customers. See Workbench Support for questions and assistance with Workbench.

1. Login to Workbench using your Salesforce credentials and select the queries dropdown | SOQL Query | Select the Object: for which you'd like to restore records from the recycle bin | View as: List and for Deleted and archived records: select Include. Alternatively, you may use the Data Loader's Export All feature to generate the .csv of deleted records to be restored instead of using Workbench as outlined in steps 2-5. See Export Data for more details.

2. Select the Id and any other fields that may be necessary to identify the records you'd like to restore. Filter results by: IsDeleted = TRUE.

Note: You can add any additional filters of your choice by clicking the green (+) button.

3. Select the Query button and you should see a list of matching results generated on the page.

4. Copy the list of records from the page including headers and paste them into Excel. If your query results in multiple pages of records you will need to repeat this for each page until you reach the end of your results.

Note: When pasting into Excel it's recommended to select Match Destination Formatting and carefully review the result to ensure that the data has been pasted properly into individual rows and that each column's values matches the appropriate header. Column A is not necessary and should be deleted if it contains a blank header and the numbering for the record results.

5. Once you've confirmed the data contained in Excel is formatted and correct, select to Save As and in the prompt's Save as type: drop down select CSV (Comma Delimited) (*.csv), where you'd like to save the file, and name it accordingly and Save. The end result should be a .csv file that contains the records you'd like to restore including their Salesforce Ids.

6. Now back in Workbench, select the data dropdown in the menu options at the top of the page and Undelete.  Select From File | Browse... and select your file from step 5 if you used Workbench or the resulting file from Export All if you used Data Loader. The file should contain all of the Ids for the records you'd like to restore | Next.  Map the Id field to the ID column in your CSV and select the Map Fields button and lastly the Confirm Undelete button.

promote demote