Print this page

Collection Size Error when accessing Visualforce page

Knowledge Article Number 000120146
Description
Upon accessing a visualforce page, you might receive an error similar to the following 

Collection size 1,046 exceeds maximum size of 1,000

 
Resolution
Visualforce is not designed to display more than 1000 records on the same page. Generally speaking, if your SOQL's are returning more than 1000 records and you attempt to display these records on a VF page, you will receive this error.

You can implement two solutions for this issue:

1- You can either limit the number of records you are trying to display to be less than 1000 or use pagination to display the records in different pages

2- You can use the @ReadOnly annotation on the method that retrieves the records or on the entire visualforce page. You can find more information about this here




promote demote