Loading

Collection size 1,028 exceeds the maximum size of 1,000.

Udgivelsesdato: Oct 18, 2025
Beskrivelse

An error message, "Collection size 1,028 exceeds the maximum size of 1,000," is displayed on the screen.

When is this error message displayed?

Løsning

Collections in Apex are data structures used to store and manage multiple records or values in a single variable. Common types include Lists (ordered collection), Sets (unique unordered collection), and Maps (key-value pairs). While Apex itself does not impose a strict limit on collection size, certain contexts like Visualforce pages restrict collections to a maximum of 1,000 items when rendering data.

Governor Limits are system-enforced restrictions in Salesforce designed to ensure efficient use of shared resources in a multi-tenant environment. These limits control aspects like CPU time, memory usage, and database operations. In this context, while Apex can handle large datasets, there are limits such as the number of records returned in certain operations (e.g., Visualforce rendering limits of 1,000 items per collection), which can trigger errors if exceeded.

Root Cause

This is an error message displayed when the limit of Visualforce page is exceeded. For details, refer to the following article:

apex:repeat
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_repeat.htm
 

A collection can contain up to 1,000 items.

Please note that this is a limit for Visualforce page itself. The same limit is applied for repetitive output, including <apex:dataList> and <pageBlockTable>. (Similar description of the limitation is found in the reference of each item.)

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_dataList.htm
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageBlockTable.htm

For Apex class, this limit was removed from Spring'10 (API 18.0). For the APIs prior to this version, a limit of 1,000 items was applied to Apex class.

Vidensartikelnummer

000385328

 
Indlæser
Salesforce Help | Article