1

I'm trying to do a staggered query using the Bulk API from a RoR app since the filter (WHERE App_Id__c IN :listOfIds) I'm using is over 4000 chars. The list of IDs I'm filtering on is quite long, so I'd love to slice it into smaller sections and make n queries to the Bulk API, building up an array of results.

I tried the below but it seems like the request never goes through:

private_class_method def self.salesforce_apps(ids)
  allsalesforceapps = []
  ids.each_slice(200) do |customer_ids_batch|
    allsalesforceapps  << Salesforce.bulk_client.query("App__c", "SELECT Id FROM App__c WHERE App_Id__c IN ('#{customer_ids_batch}')")
  end

  allsalesforceapps
end

Any ideas?

3
  • I think you may be taking the wrong approach, but I'm not sure. What's the source of the list of ID values you're querying from? It might be easier to just perform a sub-query if possible.
    – sfdcfox
    Commented Oct 19, 2018 at 23:07
  • Hey sfdcfox, we tried to use a subquery but found that we really need the specific list of App IDs, is there any way to stagger these querys and build up a list?
    – McD
    Commented Oct 22, 2018 at 17:23
  • The Bulk API is used to asynchronously retrieve a large number of records that meet a specific SOQL that you can fit into the normal rules. Trying to do what you're doing will quickly exhaust your API daily limits. You should use either a sub-query filter or a child sub-query on the parent object. You need to take a step back and focus on the larger picture.
    – sfdcfox
    Commented Oct 22, 2018 at 17:29

0

You must log in to answer this question.

Browse other questions tagged .