+ Start a Discussion
samita das 7samita das 7 

collection size exceeds

Hi All,

Problem :
I am trying to diaplay all the opportunity records in vf page. The records are more than 10000. 
Also I have set readOnly=true on vf page. The collection size increased from 1000 to 10000 but still I am not able to display.

What I did :
I queried the opportunity records and stored in a list and used datatable to populate that list on vf page.
I also tried using StandardSetController and used pagination . But then I faced issue of "
Too many query locator rows: 10003 " .I know its the limitation.

Please help me to achieve this scenario.Any workaround for this ???
Naval Sharma4Naval Sharma4
Are you using the Database.getQueryLocator? If yes then you can only query 10,000 results. Also, make sure you are using the getCompleteResult() method to get the results.
samita das 7samita das 7
Hi Naval,

Yes. Any other ways how to achieve this screnario?
Naval Sharma4Naval Sharma4
You can do a SOQL without using the Database.queryLocator.

just do something like below.
[SELECT Id, Name FROM Account] 

But you will have to use pagination on the client side and you will have to avoid using apex:dataTable or apex:repeat. 

Client Side pagination  (https://force201.wordpress.com/2014/03/15/connecting-datatables-to-json-generated-by-apex/)