Salesforce REST API supports the getdeleted endpoints to furnish a list of deleted records for an SObject. The response from the API looks like this
{
"deletedRecords" :
[
{
"id" : "a00D0000008pQRAIA2",
"deletedDate" : "2013-05-07T22:07:19.000+0000"
}
],
"earliestDateAvailable" : "2013-05-03T15:57:00.000+0000",
"latestDateCovered" : "2013-05-08T21:20:00.000+0000"
}
The problem is that this response does not contain any information about the user who performed the delete. How to get the Id of the user who performed this operation?
We cannot make an API call on the respective SObject Id(to get LastModifiedBy
) as it has been deleted and will not appear in the normal API call. What is the solution?
One way could be to use the queryall()
functionality of the SOAP API. How can this be done using the REST API? Even if this approach works, it will only work for records that have moved to the recycle-bin after the delete i.e a soft delete. What about the records that have been hard deleted directly?
As an observation, if you go to the recycle-bin it shows the Deleted By
and Deleted Date
on the deleted records. How does Salesforce show that information because SObjects dont seem to have fields for deleted-by and deleted-date. If there is, how can it be used to solve this problem?