As per Visualforce Limits:
Maximum number of collection items that can be iterated in an iteration component such as
<apex:pageBlockTable>
and<apex:repeat>
-- 1,000
So normally 1,000 is the limit. If try to iterate over more than 1,000 items then we receive this error:
collection size exceeds maximum size error
I observe when we use List<Sobject>
variable to iterate over apex:repeat
then we get this(collection size exceeds maximum size) error. But when I use Map<Id, Sobject>
then I can iterate over more than 10,000 records (I tested with 20,000 records).
Noted: You can only iterate over 20,000 if view state does not exceed 135 KB
My Conclusion: It looks like this limitation doesn't apply on Map<Id, Sobject>
.
I tried to find documentation related to this issue, but could find nothing. It doesn't seem like Salesforce's official documentation mentions it anywhere.
So what is the reason map doesn't hit the limit? Looks like a Salesforce hidden secret, or I am just imagining things?
repeats
within arepeat
approach workaround (of course, CSV would be unsorted) (2) atransient
map would avoid viewstate issues