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
Vadivel MuruganVadivel Murugan 

MultipickList Package

Hi,

Please any know how add more than 1000 values in multipick list. When i have to add more than 1000 values in multipick list values to show the error in: Collection size 2,821 exceeds maximum size of 1,000. How to rectify these problem.

My Vf page is:

<apex:page standardController="Engineer__c" extensions="MultiListselectController" showHeader="false">
 
 <apex:form >
  <apex:pageBlock title="Postal Code">
  
            <c:MultiselectPicklist leftLabel="Available Postal Code" 
            rightLabel="Selected Postal Code" 
            width="150px" size="14" 
            leftOption="{!allCodes}" rightOption="{!selectedCode}">
            </c:MultiselectPicklist>
 

            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="OK" />
                <apex:commandButton action="{!cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    
  </apex:form>
  
</apex:page>

My Controller:

public with sharing class MultiListselectController {

    public SelectOption[] selectedCode { get; set; }
    public SelectOption[] allCodes { get; set; }
    String code;
    
  /*  public PaginatedSelectList allCodes{
        get{
            if(allCodes==null){
                  allCodes=new PaginatedSelectList();
                  for(Postal_Code__c c:[SELECT Name FROM Postal_Code__c]){
                        allCodes.add(new SelectOption(c.Name,c.Name));
                  }
            }
            return allCodes;
        }
        set;
    }
    */
    
    List <String> Postalexscode;
    List<Postal_Code1__c> prd =new List<Postal_Code1__c>();
    
    Engineer__c codes;
 
    public MultiListselectController(ApexPages.StandardController controller) {
        
        selectedCode = new List<SelectOption>();
        
      allCodes= new List<SelectOption>();
        
        codes = [select Postcode_Areas__c from Engineer__c where id=:apexpages.currentpage().getparameters().get('id')];
        
        if(codes.Postcode_Areas__c != null){
        Postalexscode = codes.Postcode_Areas__c.split(',',0);
        prd = [SELECT Name FROM Postal_Code1__c where Name!=: Postalexscode];
        }
        else{
        prd = [SELECT Name FROM Postal_Code1__c];
        }
        
       for (Postal_Code1__c c: prd) {
               
               allCodes.add(new SelectOption(c.Name,c.Name));
       }
      
 }
      
    public PageReference save() {
    
    if(codes.Postcode_Areas__c == null)
    codes.Postcode_Areas__c ='';
    
        for (SelectOption so : selectedCode) {
        if(codes.Postcode_Areas__c == '')
        codes.Postcode_Areas__c += so.getLabel();
        else
        codes.Postcode_Areas__c += ','+so.getLabel();
        }
        
        update codes;
        
        return new PageReference('/'+apexpages.currentpage().getparameters().get('id'));       
    }
    
    public PageReference cancel() {
    return new PageReference('/'+apexpages.currentpage().getparameters().get('id')); 
    }
}

Any one know reply me.