What is the lifecycle of isDeleted records?

Quick question. I have record that I deleted two days ago. I still can do SOQL query and get it in workbench using isDeleted field.

Does Salesforce have some recycle mechanism for these kind of records? Will I still able to select isDeleted records in an year for instance?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Records once deleted reside in the recycle-bin, and they stay there for 15 days unless to forcefully delete them. Salesforce documentation regarding this states two important points

  • Deleted records remain in the recycle bin for 15 days, and can be restored during that time. To permanently remove your deleted items before the 15-day period, administrators and users with the Modify All Data permission, can click Empty your Recycle Bin or Empty your organization’s Recycle Bin.
  • After 15 days, deleted items are purged from the recycle bin, and once purged, they can’t be recovered.

How to troubleshoot the data, that is removed from Recycle bin

Records may still be queried, as the documentation states

If the records are deleted from the Recycle Bin, you may still be able
to query on the record to retrieve the information but you cannot
Undelete the same.

Note that availability of the records in the
Recycle Bin may be variable and we cannot guarantee a specific length
of time
they will be available to query once removed or hard deleted
from the recycle bin.

As for “will you be able to query records after a year of deletion”, Salesforce doesn’t guarantee the specific length of time the deleted records can be queried. I am sure Salesforce won’t give a year’s leverage to its customers for deleted records.

Method 2

Deleted records remain in the recycle bin for 15 days, and can be restored during that time. To permanently remove your deleted items before the 15-day period, administrators and users with the “Modify All Data” permission, can click Empty your Recycle Bin or Empty your organization’s Recycle Bin. After 15 days, deleted items are purged from the recycle bin, and once purged, they can’t be recovered.

IsDeleted = false, will skip querying for the deleted records, this would infact increase your query performance, as the data volume will decrease. Placing the filter also plays an important role in querying, putting the filter that would reduce the number of records fetched in big way should be placed first and then so on.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x