function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

describeGlobal call


I would like to retrieve the system settings data of salesforce instance I am using . I know that describeGlobal() call is able to return those data. But does anyone know how can I use this call  ? In the Salesforce Developer Console , how can I write this call ? Or is there a easist way to use this call ? For instance, in unix we just need to write a command in the terminal.

Leslie  KismartoniLeslie Kismartoni
You can use the DeveloperConsole to run ad hoc scripts/commands. Some instructions and a test script are below...

You can read different commands from here

Try this? (It counts the number of relationships for an object...)
Map<String, Integer> countMap = new Map<String, Integer>();
// Get a list of all the objects
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
// Use the keys to handle lookups to the code. Note: Keys are in a set while the fx takes a list - convert the set to a list
Schema.DescribeSobjectResult[] results = Schema.describeSObjects(new List<String>(gd.keySet()));

for(Schema.DescribeSobjectResult res : results) {
    // Get child relationships
    Schema.ChildRelationship[] rels = res.getChildRelationships();
	List<Schema.ChildRelationship> filteredRels = new List<Schema.ChildRelationship>();
    for (Schema.ChildRelationship relationship : rels) {
        if (relationship.getRelationshipName() != null && relationship.getRelationshipName().contains('__r')) {

	// Debug output.
    if (rels.size() > 0) { System.debug(res.getName() + ' has ' + rels.size() + ' child relationships.'); }
    //if (res.deletable && res.custom && (!res.customSetting)) { 
        countMap.put(res.getName(), filteredRels.size()); 

System.debug('***** countMap: ' + countMap);

Click the name/setup area and select Developer Console.
User-added image

A new window will popup - click Debug and click the first choice (Open Execute Anony...)

User-added image

Paste your commands in ... Check the "open log" and then hit execute.
User-added image

Once the code runs, it'll open the log file. You can check the only debug output on it to show only the debug messages...
User-added image

If this helps, consider marking it the answer?

Thanks.  How can I get the basic information of the salesforce instance. Like the information in

I check the description ofDescribeSObjectResult :

Not sure which field is the one for salesforce instance basic information.
Leslie  KismartoniLeslie Kismartoni
Not sure what you mean by "salesforce instance basic information" - could elaborate?
I guess I'm just not sure what information you are actually looking for... 

Basically, the DescribeGlobal call is an API call that returns what sObjects are available in the Salesforce ORG.

The Schema.getGlobalDescribe() is the equivalent function that you can run from inside APEX language.

Hi, I mean the basic information, for instance, in the .

something likes the "encoding", "maxBatchSize", etc.