You need to sign in to do that
Don't have an account?
About Me
Collection size 1,132 exceeds maximum size of 1,000
Hello,
Trying to display sObjects and the fields of the sObject selected on vf page and in the process stuck with the error 'Collection size 1,133 exceeds maximum size of 1,000.' Any suggestions or code sample would be greatly appreciated, thank you.
I have tried creating list of lists but no use.
Tried creating a Map to return the object names but not succesfull in doing so.
And no I cannot set read only attribute ='true' as I have a DML operation to be performed.
Trying to display sObjects and the fields of the sObject selected on vf page and in the process stuck with the error 'Collection size 1,133 exceeds maximum size of 1,000.' Any suggestions or code sample would be greatly appreciated, thank you.
I have tried creating list of lists but no use.
Tried creating a Map to return the object names but not succesfull in doing so.
And no I cannot set read only attribute ='true' as I have a DML operation to be performed.
<apex:page controller="searchAndDelCntrl" readOnly="false" lightningStylesheets="true"> <apex:form id="formblock" > <apex:pageBlock id="block"> <apex:pageMessages escape="false"/> <apex:pageBlockSection > <apex:pageBlockSectionItem > <apex:panelGrid columns="10" id="theGrid"> <apex:outputLabel for="ObjectName" >Object: </apex:outputLabel> <apex:SelectList id="ObjectPicklist" value="{!selectedDataObject }" size="1" onchange="DataFeedAction()"> <apex:selectOptions value="{!ObjectOption}" /> <apex:actionFunction name="DataFeedAction" status="waitingStatus" reRender="block"/> </apex:SelectList> <apex:outputLabel for="ColumnName">Field: </apex:outputLabel> <apex:selectList id="ObjectFieldPicklist" value="{!selectedFieldName}" multiselect="true" size="5" > <apex:selectOptions value="{!FieldOptions }" /> </apex:selectList> <apex:commandButton value="Search" action="{!doSearch}" rerender="block" status="status"/> </apex:panelGrid> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:actionStatus id="status" startText="requesting..."/> </apex:pageBlock> </apex:form> <script> function MyjavaFunction(ReceiveObjectID,ReceiveFieldID ){ //onclick="if(MyjavaFunction('{!$Component.ObjectPicklist}','{!$Component.ObjectFieldPicklist}')) {return};" //onclick="if(!MyjavaFunction('{!$Component.ObjectPicklist}','{!$Component.ObjectFieldPicklist}')) {return};" // onclick="if(!MyjavaFunction('{!$Component.ObjectPicklist}','{!$Component.ObjectFieldPicklist}')) {return};" var inputValue = document.getElementById(ReceiveObjectID).value; if(inputValue == '0'){ alert('Please select any item from object.'); return false; } else { var inputFieldValue = document.getElementById(ReceiveFieldID).value; // alert(document.getElementById(ReceiveFieldID).value); if(inputFieldValue== '0' || inputFieldValue=='' ){ alert('Please select any item from field picklist.'); return false; } } } </script> </apex:page>Controller--------->
public with sharing class SearchFieldControllerNew { // variables and properties String strUserID ; public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); public List<SelectOption> objectNames{get;set;} public String selectedDataObject { get; set; } public String selectedFieldName{ get; set; } /* List<ReportFieldsUsed__c> results; public List<ReportFieldsUsed__c> getResults() { return results; } */ public SearchFieldControllerNew(){ objectNames = initObjNames(); } public List<SelectOption> initObjNames(){ List<SelectOption> objNames = new List<SelectOption>(); List<String> entities = new List<String>(schemaMap.keySet()); entities.sort(); for(String objName : entities){ if (!objName.contains('__share') && !objName.contains('__tag') && !objName.contains('__history') && !objName.contains('__feed')) { objNames.add(new SelectOption(schemaMap.get(objName).getDescribe().getName(),schemaMap.get(objName).getDescribe().getName())); } } return objNames; } // Search filed depending upon object selected from above public List<selectOption> FieldOptions { get{ try { System.Debug('pkp : ' + selectedDataObject); List<SelectOption> FieldOption = new List<SelectOption>(); //FieldOption.add(new SelectOption('0','--None--')); //FieldOption.add(new SelectOption('0','--None--')); Schema.sObjectType objectType = Schema.getGlobalDescribe().get(selectedDataObject); // for example Map<String, Schema.sObjectField> fieldMap = objectType.getDescribe().fields.getMap(); for (String fieldName : fieldMap.keySet()) { //System.debug('DJR >> ' + fieldName + ' (' + fieldMap.get(fieldName).getDescribe().getName() + ') ' + fieldMap.get(fieldName).getDescribe().getName()); FieldOption.add(new SelectOption(fieldMap.get(fieldName).getDescribe().getName(),fieldMap.get(fieldName).getDescribe().getName())); } FieldOption.sort(); return FieldOption; } catch(Exception e) { System.Debug(' Exception : '+ e.getMessage()); return null; } } set; } // Method Dosearch is called on click of the button and passed three parameters to the batch class. public PageReference doSearch() { System.Debug('pkp selected object API :' +selectedDataObject); System.Debug('pkp selected field :' +selectedFieldName); try{ // server side validation if(selectedDataObject == '0' || selectedFieldName=='[]') { if(selectedDataObject == '0') { ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select any item from Object Picklist.')); return null; } if(selectedFieldName=='[]') { ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select any item from Field Picklist.')); return null; } } else { System.Debug('pkp : ' + selectedDataObject); strUserID =UserInfo.getUserId(); List<ReportFieldsUsed__c> fldids = new list<ReportFieldsUsed__c>(); //List<ReportFieldsUsed__c> existing = [SELECT Id From ReportFieldsUsed__c where userid__c =:strUserID]; for(ReportFieldsUsed__c f:[SELECT Id From ReportFieldsUsed__c where userid__c =:strUserID]) { ReportFieldsUsed__c rpf = new ReportFieldsUsed__c(); rpf.Id = f.Id; fldids.add(rpf); } delete fldids; //System.Debug('pkp selected object API :' +selectedDataObject); //System.Debug('pkp selected field :' +selectedFieldName); //System.Debug('pkp current user :' +strUserID); SearchReportFieldBatchNew obj = new SearchReportFieldBatchNew(selectedDataObject,selectedFieldName,strUserID); if(!Test.isRunningTest()) Database.executeBatch(obj,1); } }catch(Exception ae){} return null; } }
Also, make sure the API version on your controller and your VF page is set to the latest version.