how to i count objects available in salesforce organization code example
Example 1: how to i count objects available in salesforce organization
map<String, Schema.SObjectType> GlobalMap = Schema.getGlobalDescribe();
for (Schema.SObjectType Obj : GlobalMap.values()) {
Schema.DescribeSObjectResult ObjDesc = Obj.getDescribe();
system.debug('Object Name: ' + ObjDesc.getName());
}
System.debug(GlobalMap.size() );
Example 2: how to i count objects available in salesforce organization
Integer count = 0;
map<String, Schema.SObjectType> GlobalMap = Schema.getGlobalDescribe();
for (Schema.SObjectType Obj : GlobalMap.values()) {
Schema.DescribeSObjectResult ObjDesc = Obj.getDescribe();
if(ObjDesc.iscustom()){
count ++;
system.debug('Object Name: ' + ObjDesc.getName());
}
}
System.debug('Custom Object '+ count );