0

This bozo (me) managed to delete some contacts that shouldn't be deleted with a list of those that should.

Now the whole world knows about it and is waiting for me to restore them.

I do this query below and get 0 results but I see at least on the the recycle bin. Why and how to fix this? I know the date and time when I did this if that helps.

SELECT Id, name, IsDeleted FROM Contact WHERE IsDeleted = TRUE

2 Answers 2

5

Use ALL ROWS

You can use ALL ROWS to query records in your organization's Recycle Bin.

So your query needs to be:

SELECT Id, name, IsDeleted FROM Contact WHERE IsDeleted = TRUE ALL ROWS
8
  • I tried this SELECT Id, name, IsDeleted FROM Contact WHERE IsDeleted = True ALL ROWS in workbench and in the developer console query and get the error MALFORMED_QUERY: ALL ROWS not allowed in this context or Parsing Error
    – Apex N-u-b
    Commented Mar 10, 2016 at 8:36
  • Try using the Dev. Console. instead. This query definitely works for me in the console, not sure why it's not working in Workbench though. Commented Mar 10, 2016 at 8:45
  • Thanks but I wrote, I tried both exactly as I pasted above. Am I supposed to type it differently.
    – Apex N-u-b
    Commented Mar 10, 2016 at 9:05
  • This runs successfully for me: system.debug([SELECT Id, name, IsDeleted FROM Contact WHERE IsDeleted = True ALL ROWS]); Try that. Commented Mar 10, 2016 at 9:11
  • 1
    You did it. I need to work on it but I should be able to restore humpy dumpdy. Many thanks.
    – Apex N-u-b
    Commented Mar 10, 2016 at 10:13
0

I hope You have gone through
Retrieve Lost Records

SELECT Id, name, IsDeleted FROM Contact WHERE IsDeleted = TRUE ALL ROWS
2
  • How is that different from my answer? Commented Mar 10, 2016 at 8:48
  • I dont know how it happened. I had written the same Commented Mar 10, 2016 at 10:28

You must log in to answer this question.

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