I have 10 Contact which are showing in my vfpage..suppose i'll delete 3 record then its show only 7 record on vfpage. i want to also show deleted record which was gone into recyclebin. what is the soql query or any keyword to show deleted record data on tha vfpage
ALL ROWS keyword in SOQL.
[SELECT COUNT() FROM Contact WHERE AccountId = a.Id ALL ROWS]
To retrieve only deleted records
[SELECT COUNT() FROM Contact WHERE isDeleted=True ALL ROWS]
ALL ROWSkeyword seems to work perfectly with apex code(Or maybe with Workbench) but not in query editor(Developer console)
- These queries returns the rows which are even deleted from recycle bin(For a limited time period) too so keep that in mind.
To query items that are in the recycle bin, just construct a query on any object where
IsDeleted=1. Like for querying deleted reports you can write a query like this -
[SELECT Id,Name FROM Account WHERE IsDeleted = true].
Please refer to this link from Salesforce for more details. https://help.salesforce.com/apex/HTViewSolution?urlname=How-to-retrieve-my-records-and-data-that-has-been-lost-or-deleted-1327108681812&language=en_US