• Laurie Hanlon
  • 0 Points
  • Member since 2013

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0



I am running some tests with queryall and am finding that it is returning records that have been deleted, but are NOT in the recycle bin.  This is primarily with Tasks, but I have come across it before with Contacts.  For example, I export all tasks where isdeleted=true, and I get 12 tasks.  I then attempt to undelete them (assuming they should be in the recycle bin) and I get errors that they are no longer in the recycle bin.  Plugging in the ID to the SF URL, it does confirm the records are deleted.


So...I think I have narrowed it down to 2 possibilities:


1.  Hard Deleted Records - The docs all say they do not go to the recycle bin (and yes they are not there as expected), but they ARE flagged with isdeleted=true, so they can be exported with queryall().  I have tested hard deleting some Tasks and Leads and WAS able to export them with queryall.


2.  Cascading Deletes - When a child record is deleted when the parent is deleted (i.e. Tasks when the Lead is deleted), the Task records ARE also flagged with isdeleted=true, but again are not directly in the recycle bin, and they ARE exported with queryall().


So it appears that the SF help documentation around isdeleted is INCORRECT unless I am missing something


Indicates whether the object has been moved to the Recycle Bin (true) or not (false). Label is Deleted.


The assumption based on the SF docs for the isdeleted field would be that any records that can be exported with queryall should be able to be undeleted using the undelete() call, but that is not true in these cases.


Also I am assuming that once a record is flushed from the recycle bin, then it can no longer be queried qith query(all).  The docs do not seem to clarify this either "Indicate where the object has been MOVED to the recycle bin" vs. is IN the recycle bin.


Can anyone confirm my findings?  


Thanks, Laurie