3

I am required to retrieve all the records (including archived and deleted records) from a Salesforce object. I understand that this can be achieved using queryAll(). However, I have an environment that has records in millions (>50M) and would prefer to query using Bulk API. I am thinking of submitting a faster approach to retrieve the data by:

  1. Querying the records (which do not contain the deleted and archived records) using Bulk API
  2. Individually query the rest.

Step 2 seems to be harder to specifically retrieve using Bulk API. If I'm not wrong, this can be achieved only by queryAll() and not by Bulk API. My understanding is that in order to retrieve the archived/deleted data is by the filter:

SELECT ID FROM OBJNAME [WHERE ISDELETED = TRUE OR ISARCHIVED = TRUE]

Is there a better way to query only the deleted and archived records taking the query load into considerations?

2
  • Bulk API v1 does support queryAll. You can still use it to query the data you want. It's still limited to 50,000,000 rows per transaction, if I recall, but will save considerable number of API calls.
    – sfdcfox
    Commented Sep 18, 2018 at 21:51
  • @sfdcfox Looked at the latest documentation. Apparently, the newest update has this on Bulk API. Older versions (using v37) didn't have this one. Also, tested on workbench (v43) still had an issue of "Including deleted and archived records not supported by Bulk Queries." Developing using API did work though!
    – dmachop
    Commented Sep 21, 2018 at 21:31

1 Answer 1

0

The Bulkv2 API now supports queryall.

When creating your job:

{
   "operation": "queryAll",
   "query": "select Id FROM Account",
   "contentType": "CSV"
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .