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
deshawdeshaw 

Visualforce list doesn't support more than 1000 elements!

I am developing a multi-picklist pop-up window for our need.

The left side has more than 4000 elements.
I am using a controller for dynamically generating the option list. The following code snippet explains this.

In the Program code:
                   <apex:selectList style="width:220px" size="10" multiselect="true" id="availableList" onfocus="skipcycle=true"         onblur="skipcycle=false" ondblclick="onAdd();">                   
                    <apex:selectOptions value="{!items_available}"/>                   
                    </apex:selectList>

In the controller,

public List<SelectOption> getItems_available()
    {
        List<SelectOption> options = new List<SelectOption>();
        for (Lead_Manager__c lm: [Select Name FROM Lead_Manager__c Where Is_Frequent__c = false and (Name like 'd%' or Name like 'e%' or Name like 'f%') ORDER BY Name ASC])
        {
                options.add(new SelectOption(lm.Name, lm.Name));       
        }
        return options;
    }

This returns a visualforce error., "System.Exception: collection exceeds maximum size: 1001"

Can anyone help on this?
Best Answer chosen by Admin (Salesforce Developers) 
KuldeepKuldeep

I have work around for you. Please check: http://kuldeeptyagi.blogspot.com/

All Answers

Ron HessRon Hess
your subject is correct, you must design your UI to use lists that are no more than 1000 elements.
this is an Apex Code limit
mtbclimbermtbclimber
FWIW, salesforce.com limits custom picklist field definitions to 1000 entries. This is also a usability concern as most users do not operate well with extremely large picklists.
VarunCVarunC

Now I got stuck into this issue too :( ...

 


mtbclimber wrote:
FWIW, salesforce.com limits custom picklist field definitions to 1000 entries. This is also a usability concern as most users do not operate well with extremely large picklists.

And to me Most users still prefer usig AB keys to navigate and Tab key navigation is not that friendly with POPUP windows to sleect Contact/Account. :(

 

I 'm trying to replace the default Contact Popup Window field with a Dropdown field in VF page but now it seems like IMPOSSIBLE ... Do you have any suggestions in that ? :)

 

 

I was thinking of Returning :List<List<Contact>> type object from APEX but HOW can I BIND that object to a SELECTOPTION control in VF ? 

Message Edited by vchaddha on 03-19-2009 09:04 AM
trublutrublu

Could you please share your code if you got the list of list to work on the VF page? We are facing the same issue, and am pretty much stuck...

 

Your help would be very much appreciated. Thank you.

VarunCVarunC

:( ... no ... there are limits .. limits .. limits everywhere .. :) ...

 

The selectoptions VF component cannot store more than 1000, the Apex variable of List type cannot store more than1000, and lastely what i can think of is ...

 

try to implement something like paging inside dropdowns, if you can do that ... so that you display data in pages of records ...

 

 

fgwarb_devfgwarb_dev

Visualforce pages are still limited to 1K items in a list BUT Apex lists/set/maps no longer have a limit to their size.

 

One should be able to work with >1K datasets in a VF page by leveraging a modified StandardSetController, documentation here:

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_pages_standardsetcontroller.htm?SearchType=Stem&Highlight=StandardSetController|standardSetController

 

Still a limit but it's 10K.

KuldeepKuldeep

I have work around for you. Please check: http://kuldeeptyagi.blogspot.com/

This was selected as the best answer
Vishal SomaiyaVishal Somaiya
<apex:page controller="StaticController" readOnly="true">

*Add readOnly="true" to exceed your limit from 1000 to 10000