function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
John DanielsonJohn Danielson 

Collection size 16,972 exceeds maximum size of 1,000.

We have a custom built Visualforce page that was created to allow our users to mass email contacts. Currently, when a user creates a list view of contacts to email and clicks the "Send Email" button, they receive an error saying, "Collection Size 16,972 exceeds maximum size of 1,000."

When I go under Setup --> Administer --> Communication Templates -->  Email Templates, I can see that there are thousands of email template for mass emails that were sent using Marketo. Everytime a user sends a mass email using the "Send Marketo Email" button, a template is added to the "Marketo Email Templates" folder. So, if a user sends a Marketo Email to 5 contacts, 5 templates are added to the folder.

I am not a developer, so I am confused as to why each email adds a template to this "Marketo Email Templates" folder. 
Prashant WayalPrashant Wayal
Hi John,

Basically this collection size error comes when any of the List variable used on visualforce page exceeds the size of 1000. This is salesforce governor limit where you can hold only 1000 values in a picklist on visualforce page. 

The other thing is I can't say why this templates are adding in that folder; may be this is your requirment at the time of development, but if you don't want to save the templates, I can help you to get this problem fixed. 

Please contact me on below details for further assistence.

Email: prashantwayal15@gmail.com
Mobile: +91 9975022535
Skype: prashantwayal
LinkedIn: https://in.linkedin.com/pub/prashant-wayal/64/232/141

Thanks & Regards,
Prashant