+ Start a Discussion
BoolsEyeBoolsEye 

setBatchSize not working ?

Code:
function runQuery() {
 sforceClient.setBatchSize(5);
 sforceClient.query("Select Id, Name From Account", queryCallBack, true);
}

function queryCallBack(qr) {
 if (qr.size > 0) {
   alert(qr.records.length);
  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).
 
Thanks,
 
// Juergen
 
 
 
 
 
 
 
SuperfellSuperfell
read the docs on batchSize, its only a hint, and in particular it in most cases won't go lower than 200.
BoolsEyeBoolsEye

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

zachzach
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: