Loading

Salesforce Visualforce Error: 'Collection Size Exceeds the Maximum Size of 1,000'

Дата публикации: Oct 18, 2025
Описание

This article explains the Salesforce Visualforce error "Collection size X exceeds the maximum size of 1,000," including when the error is displayed and why it occurs.

Решение

This article answers the question: why does the "Collection size exceeds the maximum size of 1,000" error appear in Salesforce, and how can it be resolved?

Background on Apex Collections

Collections in Apex are data structures used to store and manage multiple records or values in a single variable. Common types include Lists (an ordered collection), Sets (a 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. While Apex can handle large datasets, there are limits such as the number of records returned in certain operations (for example, Visualforce rendering limits of 1,000 items per collection), which can trigger errors if exceeded.

Root Cause

This error message is displayed when the collection limit of a Visualforce page is exceeded. A collection can contain up to 1,000 items. This limit applies to the Visualforce page itself, and the same limit applies to repetitive output components, including <apex:repeat>, <apex:dataList>, and <apex:pageBlockTable>. A similar description of the limitation is found in the reference documentation for each component.

For Apex classes, this limit was removed starting in Spring '10 (API 18.0). For API versions prior to that, a limit of 1,000 items was applied to Apex classes as well.

Related Documentation

Номер статьи базы знаний

000385328

 
Загрузка
Salesforce Help | Article