0

Is there a way to query Salesforce records that have been deleted, using python simple-salesforce? In other words can it do this:

SELECT Id FROM Contact WHERE isDeleted=true and masterRecordId != null 
  AND SystemModstamp > 2006-01-01T23:01:01+01:00

This query is what Salesforce suggests to know when two records have been merged.

While the simple-salesforce deleted() method returns a list of ids deleted, it does not give the masterRecordId.

The Salesforce restful api supports a 'query_all' to get logically deleted records. However simple-salesforce's query_all is a wrapper around query() and query_more()

davejagoda
  • 2,420
  • 1
  • 20
  • 27
dlink
  • 1,489
  • 17
  • 22
  • Do you think that it would be considered metadata on the Contact? There is a function for that but I'm not sure what it returns either. – Matthew Green Jun 12 '14 at 21:24
  • No, it is not meta data. It is records in the Contact Object with the isDeleted set to true (logical deletion). These records are viewable in the Recycle bin online. – dlink Jun 17 '14 at 15:26

1 Answers1

0

You can use flag include_deleted=True. Function defenition is like - def query(self, query, include_deleted=False, **kwargs)

You can use the same flag for query_more, query_all, query_all_iter etc ..

Github link - https://github.com/simple-salesforce/simple-salesforce/blob/master/simple_salesforce/api.py

faisal_kk
  • 1,039
  • 1
  • 11
  • 19