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

Trying to see who deleted specific tasks (SOQL)

I am trying to find our deleted and completed tasks using the following query:


select id, accountid, subject, result_codes_TASK__c, lastmodifieddate from Task

where isdeleted = true AND isclosed = true AND result_codes_TASK__c <> 'NA' AND result_codes_TASK__c <> 'Action'

order by lastmodifieddate


However I am finding that the lastmodifiedbyid and the lastmodifieddate are not the same as the user and date in the recylce bin.


I tested it by deleting someone elses completed task, and it still showed their information in the lastmodified fields.


Any help here would be much appreciated.


in salesforce record get stored in recycle bin for 15 Days so you need to also remove these delete items from recycle bin also.

How would you match the item from SOQL to the recycle bin. Task names are not unique.

You can apply SOQL using where clauses isDeleted = true.

I'm having no problem getting the list of tasks deleted. I just need to know who deleted them.

then get LastModifiedbyID


this id should be idof any user who delete these records

That is showing who last modified any data in the Task but is not always who deleted it.

we are also checking isDeleted = true