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
Anu-SFDCAnu-SFDC 

Too many field describles error-salesforce

Hi,

 

 

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

Ronak PatelRonak Patel

Here the getLimitFieldsDescribes limit Occurs

Maximum 100 Describe is called.

Anu-SFDCAnu-SFDC

Hi,

 

I know my code debug shows 101 out of 100 field describes..

 

But my question is how to overcome this?? How to remove describe statement from for loop???