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
anil Kumaranil Kumar 

how to Find out how deleted a record in Salesforce

Hi All,

We have ServiceMax managed package custom object  in our org. We have found thousands of records have been deleted and they were available in recycle bin. We are able see user id of deleted records. But how to Find out how the records were deleted. We have verified the code trigger and batch classes in could not found delete operation in that. How to find how the records were deleted?

Thanks,
Anil Kumar
Rafael de Campos - STCRafael de Campos - STC
Hi Anil,

You can make a query with "ALL ROWS" that return the deleted and the existing records of a object,

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_query_all_rows.htm

I hope this info help you :)

Good luck!
Deepali KulshresthaDeepali Kulshrestha
Hi anil,

Salesforce administrators can determine who deleted a record by looking at the Recycle Bin or querying for deleted records via API.

The 'Deleted By' column will indicate which User deleted the record. If the record doesn't exist, you may still view the record via API before Salesforce permanently deletes the record.

I suggest you visit this link,it will help you:

https://help.salesforce.com/articleView?id=000199422&language=en_US&type=1

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

 Thanks and Regards,
 Deepali Kulshrestha
 
Ajay K DubediAjay K Dubedi
Hi Anil,

Check the Recycle Bin:
The 'Deleted By' column will indicate which User deleted the record. If the record doesn't exist, you may still view the record via API before Salesforce permanently deletes the record.

Use the Data Loader:
If the record doesn't exist in Recycle Bin, you'll need to log into Data Loader.
1.  In the Data Loader, click Export All.
2.  Select the Object and choose the target for export file. Click Next.
3.  Click Select all fields.
4.  Create filter 'IsDeleted' = True.  Click Add Condition.
5.  Click Finish.
6.  Open the CSV file.
7.  Column 'Last Modified By ID' is the User record ID that deleted the record.

For Professional Edition or below, you may be able to leverage Dataloader.io to query for records that are no longer in the Recycle Bin.
1.  Log into http://dataloader.io.
2.  Click New Task.
3.  Select Export.
4.  Select 'Object,' and then click Next.
5.  Select ll Fields. Set Filter 'Deleted' = True.
6.  Click + | Next.
7.  Expand 'Advanced.'  Set 'Export All Records' = checked.
7.  Click Save and Run.
8.  Click on hyperlink (ie...# success) to download the CSV file.
9.  Open the CSV file.
10. Column 'Last Modified By ID' is the user record ID that deleted record.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi