You need to sign in to do that
Don't have an account?

Too many fields describes: 11
We are currently facing the following error in the visualforce page:
System.Exception: Too many fields describes: 11
I assume this is because
Schema.SObjectType.Features__c.fields.getMap(); is getting called multiple times and exceeding the VF limit.
I tried using Describeresult instead of getMap.
For Example: Schema.DescribeFieldResult F = Account.AccountNumber.getDescribe();
But the Object and the field name has to be dynamic in our case. I need to know if theres any way where we can pass the object and field dynamically in the DescribeFieldResult statement .
So could anyone suggest some solution to this problem?
You may be describing the sobject inside a loop(ex:- 'For loop'). If so put that part outside the loop and retry.
You can use the 'Database.query()' part inside the loop.
All Answers
You may be describing the sobject inside a loop(ex:- 'For loop'). If so put that part outside the loop and retry.
You can use the 'Database.query()' part inside the loop.
Hi,
Can you plz explain me more..
Here is my part of code..
schema.describefieldresult dfield;
Map <String, Schema.SObjectField> fieldMap = Schema.SObjectType.Opportunity.fields.getMap();
for(Schema.SObjectField sfield : fieldMap.Values()){
dfield = sfield.getDescribe();
Pair field = new Pair();
field.key = dfield.getname();
field.label = dfield.getLabel();
field.fieldname = dfield.getname();
field.val = dfield.getDefaultValueFormula();
fields.add(field.label);
if(field.fieldname== 'npe01__Contact_Id_for_Role__c'){
field.val =contactId;
opt.put(field.fieldname,field.val);
}
}
But, I got too many field describes..
Can any one help me out..
Thanks
Anu