[SalesForce] What all is in Schema.getGlobalDescribe()?

what all is returned in that call? i tried debugging it but it was truncated.

Does it tell you for example the names of all your apex classes, VF pages, layouts, recordtypes etc?

Best Answer

The method returns a Map<String, Schema.SObjectType>. The String key is the lower-case API Name (though get methods on this map are case-insensitive). It contains every object in your org.

You can also debug them one by one:

Map<String, SObjectType> sObjects = Schema.getGlobalDescribe();
for (String apiName : sObjects.keySet())

You should be able to answer this question yourself by simply reading the Schema class documentation. Relevant bit:

Returns a map of all sObject names (keys) to sObject tokens (values) for the standard and custom objects defined in your organization.

public static Map<String, Schema.SObjectType> getGlobalDescribe()

Return Value
Type: Map<String, Schema.SObjectType>

For more information, see Accessing All sObjects.


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

Accessing All sObjects

Use the Schema getGlobalDescribe method to return a map that represents the relationship between all sObject names (keys) to sObject tokens (values). For example:

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

The map has the following characteristics:

  • It is dynamic, that is, it is generated at runtime on the sObjects currently available for the organization, based on permissions.
  • The sObject names are case insensitive.
  • The keys are prefixed with the namespace, if any.*
  • The keys reflect whether the sObject is a custom object.
Related Topic