Database.QueryLocator ql = Database.getQueryLocator('select id from account limit 1');
ApexPages.StandardSetController setController = new ApexPages.StandardSetController(ql);


NumberOfRecords = setController.getResultSize();  

Showing only 10k even if filter having more than 10k.

Any other way to get it

Thanks in advance.


This behaviour is documented as

The maximum record limit for StandardSetController is 10,000 records. Instantiating StandardSetController using a query locator returning more than 10,000 records causes a LimitException to be thrown. However, instantiating StandardSetController with a list of more than 10,000 records doesn’t throw an exception, and instead truncates the records to the limit.

You can refer standard document.link on this behaviour


Refer note section.

The solution should be to paginate your list rather than keeping 10000 records.

|improve this answer|||||
  • But how can i make filter view id? I need to send a mail to all list view records through batch apex. – Sunny Dec 28 '14 at 8:55
  • Send mails in batches .First mail with 5K and then 5K .Or send the link only to view the records . – Mohith Shrivastava Dec 28 '14 at 9:04
  • return Database.getQueryLocator(select id,email from contact ); how can i make list view id in query? – Sunny Dec 28 '14 at 9:25

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.