The following are methods for Schema. All methods are static.
public static Map<String, Schema.SObjectType> getGlobalDescribe()
Type: Map<String, Schema.SObjectType>
For more information, see Accessing All sObjects.
Map<String, Schema.SObjectType> gd =
Schema.getGlobalDescribe();
public static List<Schema.DescribeDataCategoryGroupResult> describeDataCategoryGroups(String sObjectNames)
You can specify one of the following sObject names:
For more information and code examples using describeDataCategoryGroups, see Accessing All Data Categories Associated with an sObject.
For additional information about articles and questions, see “Managing Articles and Translations” and “Answers Overview” in the Salesforce online help.
public static List<Schema.DescribeSObjectResult> describeSObjects(List<String> sObjectTypes)
Type: List<Schema.DescribeSObjectResult>
This method is similar to the getDescribe method on the Schema.sObjectType token. Unlike the getDescribe method, this method allows you to specify the sObject type dynamically and describe more than one sObject at a time.
You can first call getGlobalDescribe to retrieve a list of all objects for your organization, then iterate through the list and use describeSObjects to obtain metadata about individual objects.
Schema.DescribeSObjectResult[] descResult = Schema.describeSObjects( new String[]{'Account','Contact'});
public static List<Schema.DescribeTabSetResult> describeTabs()
Type: List<Schema.DescribeTabSetResult>
An app is a group of tabs that works as a unit to provide application functionality. For example, two of the standard Salesforce apps are “Sales” and “Call Center.”
The describeTabs method returns the minimum required metadata that can be used to render apps in another user interface. Typically, this call is used by partner applications to render Salesforce data in another user interface, such as in a mobile or connected app.
In the Salesforce user interface, users have access to standard apps (and might also have access to custom apps) as listed in the Salesforce app menu at the top of the page. Selecting an app name in the menu allows the user to switch between the listed apps at any time.
This example shows how to call the describeTabs method.
Schema.DescribeTabSetResult[] tabSetDesc = Schema.describeTabs();
This is a longer example that shows how to obtain describe metadata information for the Sales app. For each tab, the example gets describe information, such as the icon URL, whether the tab is custom or not, and colors. The describe information is written to the debug output.
// Get tab set describes for each app List<Schema.DescribeTabSetResult> tabSetDesc = Schema.describeTabs(); // Iterate through each tab set describe for each app and display the info for(DescribeTabSetResult tsr : tabSetDesc) { String appLabel = tsr.getLabel(); System.debug('Label: ' + appLabel); System.debug('Logo URL: ' + tsr.getLogoUrl()); System.debug('isSelected: ' + tsr.isSelected()); String ns = tsr.getNamespace(); if (ns == '') { System.debug('The ' + appLabel + ' app has no namespace defined.'); } else { System.debug('Namespace: ' + ns); } // Display tab info for the Sales app if (appLabel == 'Sales') { List<Schema.DescribeTabResult> tabDesc = tsr.getTabs(); System.debug('-- Tab information for the Sales app --'); for(Schema.DescribeTabResult tr : tabDesc) { System.debug('getLabel: ' + tr.getLabel()); System.debug('getColors: ' + tr.getColors()); System.debug('getIconUrl: ' + tr.getIconUrl()); System.debug('getIcons: ' + tr.getIcons()); System.debug('getMiniIconUrl: ' + tr.getMiniIconUrl()); System.debug('getSobjectName: ' + tr.getSobjectName()); System.debug('getUrl: ' + tr.getUrl()); System.debug('isCustom: ' + tr.isCustom()); } } } // Example debug statement output // DEBUG|Label: Sales // DEBUG|Logo URL: https://na1.salesforce.com/img/seasonLogos/2014_winter_aloha.png // DEBUG|isSelected: true // DEBUG|The Sales app has no namespace defined.// DEBUG|-- Tab information for the Sales app -- // (This is an example debug output for the Accounts tab.) // DEBUG|getLabel: Accounts // DEBUG|getColors: (Schema.DescribeColorResult[getColor=236FBD;getContext=primary;getTheme=theme4;], // Schema.DescribeColorResult[getColor=236FBD;getContext=primary;getTheme=theme3;], // Schema.DescribeColorResult[getColor=236FBD;getContext=primary;getTheme=theme2;]) // DEBUG|getIconUrl: https://na1.salesforce.com/img/icon/accounts32.png // DEBUG|getIcons: (Schema.DescribeIconResult[getContentType=image/png;getHeight=32;getTheme=theme3; // getUrl=https://na1.salesforce.com/img/icon/accounts32.png;getWidth=32;], // Schema.DescribeIconResult[getContentType=image/png;getHeight=16;getTheme=theme3; // getUrl=https://na1.salesforce.com/img/icon/accounts16.png;getWidth=16;]) // DEBUG|getMiniIconUrl: https://na1.salesforce.com/img/icon/accounts16.png // DEBUG|getSobjectName: Account // DEBUG|getUrl: https://na1.salesforce.com/001/o // DEBUG|isCustom: false
public static List<Schema.DescribeDataCategoryGroupStructureResult> describeDataCategory GroupStructures(List<Schema.DataCategoryGroupSobjectTypePair> pairs)
Type: List<Schema.DescribeDataCategoryGroupStructureResult>