function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
wkuehlerwkuehler 

Query deleted by

Does anyone know of a way to query on the deleted by field?  An example of what I am looking for is:

var queryResult = sforce.connection.queryAll("Select Id, Name, DeletedBy from Lead where IsDeleted = true");
Any ideas?
 
DevAngelDevAngel
Not sure about this, but does a combination of isDeleted and lastModifiedBy work?
wkuehlerwkuehler
No.  The LastModifiedById gives you the ID of the user who made the last modification before the record was deleted, not the ID of the person who actually deleted the recorded.
DevAngelDevAngel
Oh, bummer.  Since we don't have a delete by field this may not be possible.


wkuehlerwkuehler
Ok, thanks.  Do you know if there is any plans to open up the recycle bin and it's four fields to the api at any time in the future? 
SuperfellSuperfell
using the new queryAll call, you can access records in the recycle bin.

when a record is deleted the lastModifiedBy & lastModifiedDate are update with the delete's info. and the isDeleted flag will be true.
fgwarb_devfgwarb_dev
For anyone coming across this post, LastModifiedById does contain the ID of the person who deleted the record.  https://www.youtube.com/watch?v=aTxi_tQJVL0