Salesforce: Restoring Deleted Records from Recycle Bin

Usually, after a record is being deleted, it will be stored in the recycle bin for 15 days. These records are being recognised by a checkbox field called IsDeleted. When a record is being deleted, this checkbox will automatically be checked.

 

Question: Can we update the IsDeleted checkbox to True?

 

Apparently, this checkbox is made READ ONLY. So how can we restore records from the recycle bin?

WARNING: You will not be able to restore any records if they are being HARD DELETED.

 

 

Method #1: Manual restore

If you only have a few data, suggest that you restore them manually. Simple go to Home -> Recycle Bin, select the records that you would like to restore and click on ‘Undlete’ button.

* Once records are restored, any child tied to these records will also be restored.

 

 

Method #2: Developer Console

You can try running a few lines of codes in the developer console. Depending on the scenario, you can program the code to restore based on different condition.

For example: Restore all Account where Isdeleted = TRUE and Created Date = TODAY().

 

 

Method #3: Re-importing deleted records

You can use Apex Data Loader to export all deleted data and re-import them. Apex Data Loader ‘Export All’ allows you to export ALL data including any soft deleted data (in recycle bin).

*This will not restore any child records as this method is as if you are re-importing all the data from scratch.*

 

 

Method #4: Workbench

You can also try Salesforce Workbench where it can query all deleted records and undelete them straight from Workbench.