Play Games

Search This Blog

Monday, April 22, 2024

How to get the count of number of custom objects in salesforce org - Salesforce Globe 4u

There are 2 ways to know this.

Solution1: Login into the org and Go to the setup --> System Overview.

Here you will find the required details.

Solution2: Run the piece of code in execute anonymous windows of Developer console

Map<String, SObjectType> sObjects = Schema.getGlobalDescribe();

Integer noOfCustomObjects = 0;

for (SObjectType obj : sObjects.values())

{

    if(obj.getDescribe().isCustom() == true) {

        noOfCustomObjects = noOfCustomObjects+1;

        //system.debug(obj.getDescribe().getName());

    }

}

System.debug('Number of Custom Objects: '+noOfCustomObjects);

Output:



No comments:

Post a Comment