+ Start a Discussion

setBatchSize not working ?

function runQuery() {
 sforceClient.query("Select Id, Name From Account", queryCallBack, true);

function queryCallBack(qr) {
 if (qr.size > 0) {
  if (qr.done != true) {
   sforceClient.queryMore(qr.queryLocator, queryCallBack, true);

I set setBatchSize to 5 but I always get all my Accounts with this code and 'done' is always true. I only have nearly 50 accounts in my database but does setBatchSize only has an effect on the query if there are more than that in the database ?  I cannot find anything I'm doing wrong in this code. (I use AJAX toolkit 3.3 beta).
// Juergen
read the docs on batchSize, its only a hint, and in particular it in most cases won't go lower than 200.

Ok, thank you. I found it in the API document.

I always thought that the value for batchSize is fixed if I set it.:smileyhappy:

// Juergen

I've never set batch size for less than 200, but have set it for a number of values up to 2000.

Now, if only SFDC would let you retrieve more than 200 records at a time... :smileywink: