2

I have a doubt, please give a suggestion. Here is it. can we get the records which we deleted from recycle bin. If it is there, please share the answer.

Thanks and regards KS Kumar

1

2 Answers 2

4

There are a couple of options, depending on what you want to achieve.

  • Use the ALL ROWS keyword. This one only works in APEX and will make sure that deleted and archived records are included in your result. For reference see Documentation.

List ls = [SELECT Id FROM Contact ALL ROWS];

  • Above query will not only return archived and deleted records but also all other records. It may prove usefull to add IsDeleted to your query.

List ls = [SELECT Id FROM Contact WHERE IsDeleted = true ALL ROWS];

  • Workbench does not allow this ALL ROWS keyword so if you want to query for deleted rows in there you have to remove it and choose to include archived and deleted records (top right in the query window)

SELECT Id FROM Contact WHERE IsDeleted = true ALL ROWS

Edit: If I misunderstood the question and you want to retrieve production records you hard deleted or have cleared from your recycle bin, you may be able to contact salesforce support for restoring your records.

1

If you have a full sandbox that is somewhat current I would check there, you could be lucky and find the record there. I would recommend backing up your data weekly moving forward.

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