You need to sign in to do that
Don't have an account?
Peter Kaye
SOQL with API to retrieve deleted records
I am searching for some example SOQL that I can use in a php script that will retrieve all records for a specified object which have been deleted since a specified date and time. Please can someone point me in the right direction on this. Thanks.
It is possible to query for all records, including deleted records using the ALL ROWS keyword in the query. There should also be a field called isDeleted which you can use to tell which records are deleted.
As for finding the deleted time, you could probably check the last modified date field on the deleted records, since deleted records shouldn't be modified after they are deleted.
Here's some helpful documentation:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_query_all_rows.htm
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_queryall.htm
Hope this helps! Please don't forget to mark best answer if this helped solve your question!
All Answers
It is possible to query for all records, including deleted records using the ALL ROWS keyword in the query. There should also be a field called isDeleted which you can use to tell which records are deleted.
As for finding the deleted time, you could probably check the last modified date field on the deleted records, since deleted records shouldn't be modified after they are deleted.
Here's some helpful documentation:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_query_all_rows.htm
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_queryall.htm
Hope this helps! Please don't forget to mark best answer if this helped solve your question!
Brilliant - thanks for your help here.