After I deleted a record from recycle bin, and I run this in Anonymous;

System.debug(database.query('select id,name from Candidate__c where id=\'a012800000Gs7IG\' all rows'));

I am able to see the record.

Can anyone tell me how long a data will live after getting deleted from recycle bin ??


the effect of deleted records from recycle bin will work after some time from the moment it is deleted from recycle bin ? i.e. after a day or two I won't get any result from this query. Because even now I see my recycle bin is empty.

2 Answers 2


You can delete records from the recycle bin by using the Database.emptyRecycleBin method:

    SELECT Id FROM Candidate__c WHERE Id = 'a012800000Gs7IG' ALL ROWS

If your record is still in the recycle bin after calling the above, you should open a ticket with support. You can also hard delete via the Bulk API if you enable it as an option.

See also: How can I permanently delete a record whose isdeleted="true", and specifically this knowledge article for details:

Record data has 3 stages of deletion:

Stage 1 - Deleted to Recycle Bin - Data in this stage can still be recovered from the recycle bin. This can also be referred to as soft deleted.

Stage 2 - Emptied from the Recycle Bin or hard deleted - Data in this stage cannot be recovered from the recycle bin but can be accessed and exported from the API using Export All (queryall) in DataLoader v21 and higher or other api tools. Records can also be put in this state directly by using the hard delete option in the Data Loader.

Stage 3 - Physically/Permanently deleted - Data in this stage has been wiped from database and only recoverable by contacting Salesforce to request a Data Recovery Service (fee associated). Please click here to learn more about the Data Recovery Process.


You can refer to these Documents- 1. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_emptyrecyclebin.htm 2. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_getdeleted.htm


Restoring Deleted Records

  • Hi Rachit, please edit the answer to include relevant information from the links. Link only answers tend to be come useless as time goes by and links break.
    – Matt Lacey
    Mar 17, 2016 at 5:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .