• Kr Satyam
  • NEWBIE
  • 5 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
Can someone help me getting All objects in org with its api name and label for org having more than 1500 objects.

I have used Schema.getGlobalDescribe() , but it is hitting CPU time limit.
Can Someone help me getting only label and api name of all objects in org .

I can not use Asynchronous apex  and Global Describe is hitting CPU Time Limit.

For GllobalDescribe I am using the below code : 
Map<String, String> mapApiAndLabel = new Map<String, String>();
for(Schema.SObjectType thisObj : Schema.getGlobalDescribe().values()) {
    Schema.DescribeSobjectResult res = thisObj.getDescribe();
    if( res.isAccessible() && res.isQueryable() && (! res.isCustomSetting()) && res.isUpdateable() && res.isCreateable() ) { 
        mapApiAndLabel.put(res.getName(), res.getLabel());
    }
}

I am using an alternate method by querying on Entity Defination but it is giving error  =
'System.QueryException: EntityDefinition does not support queryMore(), use LIMIT to restrict the results to a single batch'
 
Map<String, String> mapApiAndLabel = new Map<String, String>();
for(EntityDefinition entDef : [SELECT QualifiedApiName, IsWorkflowEnabled , Label FROM EntityDefinition Where IsApexTriggerable = true AND IsCustomizable = true 
                               AND IsCompactLayoutable = TRUE AND IsCustomSetting = False AND IsDeprecatedAndHidden = FALSE And IsEverUpdatable = TRUE 
                               And IsQueryable = TRUE AND IsReplicateable = TRUE AND IsWorkflowEnabled = TRUE 
                               Limit 2000 ] 
   ){
       mapApiAndLabel.put(entDef.QualifiedApiName, entDef.Label);
   }

Can someone hellp me getting object label and api name using Metadata Services
Can Someone help me getting only label and api name of all objects in org .

I can not use Asynchronous apex  and Global Describe is hitting CPU Time Limit.

For GllobalDescribe I am using the below code : 
Map<String, String> mapApiAndLabel = new Map<String, String>();
for(Schema.SObjectType thisObj : Schema.getGlobalDescribe().values()) {
    Schema.DescribeSobjectResult res = thisObj.getDescribe();
    if( res.isAccessible() && res.isQueryable() && (! res.isCustomSetting()) && res.isUpdateable() && res.isCreateable() ) { 
        mapApiAndLabel.put(res.getName(), res.getLabel());
    }
}

I am using an alternate method by querying on Entity Defination but it is giving error  =
'System.QueryException: EntityDefinition does not support queryMore(), use LIMIT to restrict the results to a single batch'
 
Map<String, String> mapApiAndLabel = new Map<String, String>();
for(EntityDefinition entDef : [SELECT QualifiedApiName, IsWorkflowEnabled , Label FROM EntityDefinition Where IsApexTriggerable = true AND IsCustomizable = true 
                               AND IsCompactLayoutable = TRUE AND IsCustomSetting = False AND IsDeprecatedAndHidden = FALSE And IsEverUpdatable = TRUE 
                               And IsQueryable = TRUE AND IsReplicateable = TRUE AND IsWorkflowEnabled = TRUE 
                               Limit 2000 ] 
   ){
       mapApiAndLabel.put(entDef.QualifiedApiName, entDef.Label);
   }

Can someone hellp me getting object label and api name using Metadata Services

I want to knw whether a checkbox was ticked or not.

 

Something like Object.fieldName.isChecked().

 

How do I do that?

  • January 23, 2012
  • Like
  • 0