0
integer n = 3000;
stringQuery = 'SELECT Id, Name, Email, Title, Phone From contact';
ApexPages.StandardSetController setCon = new ApexPages.StandardSetController(database.getQueryLocator(stringQuery));
setCon.setPageSize(n); // error 

when I try to set page size as 3000 it will throw an error( Internal Salesforce.com Error).

  • 1
    Not quite sure but in another post, it is mentioned 2000 is the max limit here. – Tushar Sharma Jul 24 '18 at 7:22
  • Have they mentioned it in the document? – Anup Kage Jul 24 '18 at 7:25
0

setCon.setPageSize(n) is number of records displayed page record.

Max batch size is 2000.

If you try to execute this script in Developer Console it works fine

integer n = 2000;
String stringQuery = 'SELECT Id, Name, Email, Title, Phone From contact';
ApexPages.StandardSetController setCon = new ApexPages.StandardSetController(database.getQueryLocator(stringQuery));
setCon.setPageSize(n);

And, upon changing n=2001 and running the script, it will show you error INVALID_BATCH_SIZE: invalid batch size: 2001

  • not for pagination, but using it for other things. – Anup Kage Jul 24 '18 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.