+ Start a Discussion
souvik9086souvik9086 

Too many fields describes: 101

Hello everyone,

 

This post is regarding the avoidance of getDescribe method.

What it is doing here is generic fields fetching from generic object selection.

It is working fine when the no of fields are less than equal to 100.  But as expected if it exceeds 100 then the above named error occurs as we all know.

 

fields = Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap();
for(SObjectField fieldtoken : fields.values()) {
     DescribeFieldResult dfr = fieldtoken.getDescribe();
    //Some logic 
}

 

 

##This statement will execute more than 100 which will error out.

 

Any suggestion? Is there any way to handle that?

 

Thanks in advance.

Here-n-nowHere-n-now

Unfortunately I don't think there's an easy way to "bulkify" the getDescribe() call.  So you'll have to segment your calls somehow.  On a VF page for instance, you might want to use action support to run 100 describes every time you click a button.