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

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.


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.