You need to sign in to do that
Don't have an account?
Carter85
Strange List Size Error
I'm working in our sandbox currently on this method:
I know from looking at other people's posts who have dealt with this error message is that it means I'm trying to populate a list on a VF page with more than 1,000 rows, except the thing is in this case I'm not trying to do that at all. The sandbox I'm working in at the moment is only a partial data one and there is literally only one record which should be returned for this query based on the criteria. And the whole process that this is contained in is working fine in production, I was only testing out an unrelated change which we'll be pushing out soon but I keep running up against this. Does anyone have any thoughts on what may be causing this?
public PageReference proceed(){ DEALER = true; if((vin != null && vin != '')){ if(vin.containswhitespace()){ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Your VIN # entry contains a blank space, which may happen during copy and pasting from a different source, please check entry and try again.')); return null; } qry = 'SELECT ID, Vin_Number__c, Insurer__r.Name, Contract_Status__c, Vehicle_Make__c, Vehicle_Model__c, Vehicle_Year__c, Name, Benefits_Options__c, Batch__r.Product_Group_Name__c, Policy_Type__c, Contract_Number__c, Term__c, Class__c, Effective_Date__c, Expiration_Date__c FROM MG_Contract_Holder__c WHERE (Vin_Number__c =:vin) AND Batch__r.Product_Group__r.Service_Contract__c = false'; searchCreate(); if(contractList.size() > 0){ CONS = true; searchHistory(); RETURNDEALER = false; return page.CM_WebClaimStep1; } else{ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'No contract found matching the information you entered, check entry and try again.')); return null; } } else{ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Please make sure the VIN Number field is filled in before searching.')); return null; } return null; } public void searchCreate(){ contractList = new List<ContractWrapper>(); for(MG_Contract_Holder__c c : database.query(qry)){ if(c.Insurer__r.Name == 'NSD'){ NSD = true; } contractList.add(new contractWrapper(c)); } }And I keep getting this error message when I execute the search: Collection size 2,327 exceeds maximum size of 1,000
I know from looking at other people's posts who have dealt with this error message is that it means I'm trying to populate a list on a VF page with more than 1,000 rows, except the thing is in this case I'm not trying to do that at all. The sandbox I'm working in at the moment is only a partial data one and there is literally only one record which should be returned for this query based on the criteria. And the whole process that this is contained in is working fine in production, I was only testing out an unrelated change which we'll be pushing out soon but I keep running up against this. Does anyone have any thoughts on what may be causing this?
Can you please put system.debug('==============='+contractList.size()) at the end of the function to check how many records are coming in?
A set-oriented standard controller can operate on a maximum of 2000 rows.
Collections referenced in other ways from VF pages have a maximum of 1000 rows.
Two options you have :
1. use pagination (if the page is not read only)
2. set readonly="true" on apex:page (if the page is read only)
Choose the best one depends on your use case.