0

I am using below code to list all the custom object

Integer count = 0; 
for ( Schema.SObjectType o : Schema.getGlobalDescribe().values() )
{
    Schema.DescribeSObjectResult objResult = o.getDescribe();
     if(objResult.isCustom())  
     {
         count++;
        //system.debug(objResult.getLabel());
    }
}
system.debug('Total custom object :'+ count);  

 // USER_DEBUG [11]|DEBUG|Total custom object :576

But when i see the system overview is different ? How to get this count match with system overview count. ?

SetUp -> System overview

enter image description here Custom object - 515

Custom setting -113

Finally got to know apex code gives all installed object which is not counted in UI data.

  • please use screen shot to explain what you mean by 'system overview' – cropredy Mar 11 '17 at 7:29
  • There might be some deleted custom setting and object present in org. That are differing this count. – Ankuli Mar 11 '17 at 7:57
  • @cropredy Setup--> System overview . This will give all custom object and custom settings count. – bharath Mar 13 '17 at 10:59
  • 5
    I am voting for closing this question, as you have asked new related one- Why PersonAccount is showed in custom object in Tooling API query?. Please let us know otherwise. – Raul Mar 13 '17 at 12:26