Closed ghost closed 6 years ago
@pbrondum - the minimum batch size for the Salesforce REST API query resource is 200 (not 1): https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_queryoptions.htm
I'll clarify this in the Swiftly Salesforce documentation.
Re. batch size for queryNext
-- I believe this is not supported by the REST API (see same link above: "Use this request header with the Query resource"). But - you'll notice the path
argument used in the queryNext
method ends with something like "-2000" -- I haven't tried yet, but if you change that number, you might be able to modify the page size, probably not more than 2000, though. If you test that 'hack' let me know, please.
Thanks
Good to know. I'll try the workaround.
Thanks,
Per
On Tue, Aug 7, 2018 at 12:07 PM Michael Epstein notifications@github.com wrote:
@pbrondum https://github.com/pbrondum - the minimum batch size for the Salesforce REST API query resource is 200 (not 1): https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers_queryoptions.htm
I'll clarify this in the Swiftly Salesforce documentation.
Re. batch size for queryNext -- I believe this is not supported by the REST API (see same link above: "Use this request header with the Query resource"). But - you'll notice the path argument used in the queryNext method ends with something like "-2000" -- I haven't tried yet, but if you change that number, you might be able to modify the page size, probably not more than 2000, though. If you test that 'hack' let me know, please.
Thanks
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mike4aday/SwiftlySalesforce/issues/85#issuecomment-411167253, or mute the thread https://github.com/notifications/unsubscribe-auth/AA4tYkBQ4sN90Xe9xXFSaW9lzPCCR9SKks5uOeWAgaJpZM4VrapP .
Trying to get 5 or 20 records at a time. Seems to be ignored. Documentation says minimum is '1'.
Also, queryNext has no batchSize parameter, is that on purpose? Would love to increase it as more record batches are retrieved. See example below..
let batchSize = 5 if reachability.connection != .none { first { salesforce.identity().compactMap { (identity) -> Void in guard identity.userID != "" else { print("Error in userid. Exit") throw EventForceError.generic(code: 100, message: "Can't determine user ID") } } }.then { userInfo -> Promise<QueryResult> in
return salesforce.query(soql: query2Execute, batchSize: batchSize, options: [])
}.done {
(result: QueryResult) -> () in
print("got (result.records.count) records")
self.accountRecords = result.records
while result.nextRecordsPath != nil {
salesforce.queryNext(path: result.nextRecordsPath!, options: []).done {
(resultNext: QueryResult) -> () in
self.accountRecords = self.accountRecords! + resultNext.records
print("Appending the next set of (batchSize)")
}
}.catch {
error in
print(error)
}
}