I have 50K records and i want to fetch all records in 1000 batch size. In sql,i do something like limit 1000 offset x
but salesforces doesn't allow offset
when it is greater than 2000. To overcome this problem, i used this trick
client.query("
SELECT Id, Name__c, CreatedDate
FROM Product__c WHERE CreatedDate < "First-Returned-Created-Date"
ORDER BY CreatedDate DESC
LIMIT 1000
")
and
But i got this error
Databasedotcom::SalesForceError: Bind variables only allowed in Apex code
So, how to apply offset
in salesforce SOQL
. I am using databasedotcom-gem. I know about queryMore()
method but for whatever reason i don't find any such API in ruby. Is there any such API available or something similar which will solve my problem.
Thanks
You can use next_page
function, it returns exactly what queryMore
does.