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

DescribeSobject -Picklistvalues



I'm retriving all the objects picklistvalues(options) through Describe(Dynamic Apex) Result.

Im getting governor limits for the -Number of picklist Describes:101.. Since in the for loop its exceeding more than 100 ,but I need to retrive for all objests in a Org.


is this possible through Batch Apex?? What is other workaround?


Please help me out..

Yoganand GadekarYoganand Gadekar

Can you post your code here?  may be you are using select query within for loop.




Public void getAllPickList(){

list<Schema.SObjectType> gd = Schema.getGlobalDescribe().Values();

list<PickList__c> list_PicklistobjType = new list<PickList__c>();


for(Schema.SObjectType obj : gd) { //for all objects in the schema

//hitting governor limits

// if ((obj.getDescribe().getLabel() == 'account') || (obj.getDescribe().getLabel()=='case') || (obj.getDescribe().getLabel() == 'contact')){

if (obj.getDescribe().getLabel() == 'account'){

Map<String, Schema.SObjectField> objFieldmap = obj.getDescribe().fields.getMap(); //field map for the given object

for(String field: objFieldmap.keyset()){

Schema.DisplayType fieldtype = objFieldmap.get(field).getDescribe().GetType(); //for each field in the object get field type

if (fieldtype == Schema.DisplayType.Picklist){ //if it's a picklist fill list with picklist values

list<Schema.PicklistEntry> pick_list_values = objFieldmap.get(field).getDescribe().getPickListValues();


for (Schema.PicklistEntry plv : pick_list_values) {


//for each picklist value, add item to picklistobj list

PickList__c piclstObj = new PickList__c(); = obj.getDescribe().getLabel();

piclstObj.PickListFiled_Name__c = objFieldmap.get(field).GetDescribe().Name;

piclstObj.PickListFiled_Value__c = plv.getValue();



} //if it's a picklist

} //for loop

} //if it matches theObjectType


insert list_PicklistobjType;