The following table lists the system methods for Schema.
| Name | Arguments | Return Type | Description |
|---|---|---|---|
| getGlobalDescribe | Map<String, Schema.SObjectType> | Returns a map of all sObject names (keys) to sObject tokens
(values) for the standard and custom objects defined in your organization.
For example:Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe(); For more information, see Accessing All sObjects. |
|
| describeDataCategory Groups | String List<sObjectNames> | List<Schema.DescribeDataCategoryGroupResult> | Returns a list of the category
groups associated with the specified objects. You can specify
one of the following sObjectNames:
For additional information about articles and questions, see “Managing Articles and Translations” and “Answers Overview” in the Salesforce online help. |
| describeDataCategory GroupStructures | pairs, topCategoriesOnly | List<Schema.DescribeDataCategoryGroupStructureResult> | Returns available category groups along with their data category structure for objects specified in the request. For additional information and code examples using describeDataCategory GroupStructures, see Accessing All Data Categories Associated with an sObject. |
The describeDataCategory GroupStructures method returns the available category groups along with their data category structure. The following are the arguments for this method.
| Name | Return Type | Description |
|---|---|---|
| pairs | List<Schema.DataCategoryGroupSobjectTypePair> | Specify one or more category groups and objects to query Schema.DataCategoryGroupSobjectTypePair. Visible data categories are retrieved for the specified
object. For more information on category group visibility, see “About Category Group Visibility” in the Salesforce online help. |
| topCategoriesOnly | Boolean | Specify true to return only the top visible category which classify the object. Specify false to return all the visible parent and child categories. Both values depend on the user's role category group visibility settings. For more information on category group visibility, see “About Category Group Visibility” in the Salesforce online help. |
Schema.DataCategoryGroupSobjectTypePair specifies a category group and an associated object. It is used by the describeDataCategory GroupStructures method to return the categories available to this object. The following table lists all the methods for Schema.DataCategoryGroupSobjectTypePair.
| Name | Arguments | Return Type | Description |
|---|---|---|---|
| getDataCategoryGroupName | String | Returns the unique name used by the API to access the data category group | |
| getSobject | String | Returns the object name associated with the data category group | |
| setDataCategoryGroupName | String | Specifies the unique name used by the API to access the data category group | |
| setSobject | String sObjectName | Void |
The sObjectName is the object name associated
with the data category group. Valid values are:
|
The describeDataCategory Groups method returns a Schema.DescribeDataCategoryGroupResult object containing the list of the category groups associated with the specified object.
List <String> objType = new List<String>(); objType.add('KnowledgeArticleVersion'); objType.add('Question'); List<Schema.DescribeDataCategoryGroupResult> describeCategoryResult = Schema.describeDataCategoryGroups(objType);
For additional information and code examples using describeDataCategory Groups, see Accessing All Data Categories Associated with an sObject.
The following table lists all the methods available as part of the data category group describe result. None of the methods take an argument.
| Name | Return Type | Description |
|---|---|---|
| getCategoryCount | Integer | Returns the number of visible data categories in the data category group |
| getDescription | String | Returns the description of the data category group |
| getLabel | String | Returns the label for the data category group used in the Salesforce user interface |
| getName | String | Returns the unique name used by the API to access to the data category group |
| getSobject | String | Returns the object name associated with the data category group |
The describeDataCategory GroupStructures method returns a list of Schema.DescribeDataCategoryGroupStructureResult objects containing the category groups and categories associated with the specified object.
List <DataCategoryGroupSobjectTypePair> pairs =
new List<DataCategoryGroupSobjectTypePair>();
DataCategoryGroupSobjectTypePair pair1 =
new DataCategoryGroupSobjectTypePair();
pair1.setSobject('KnowledgeArticleVersion');
pair1.setDataCategoryGroupName('Regions');
DataCategoryGroupSobjectTypePair pair2 =
new DataCategoryGroupSobjectTypePair();
pair2.setSobject('Questions');
pair2.setDataCategoryGroupName('Regions');
pairs.add(pair1);
pairs.add(pair2);
List<Schema.DescribeDataCategoryGroupStructureResult>results =
Schema.describeDataCategoryGroupStructures(pairs, true);For additional information and code examples using describeDataCategory GroupStructures, see Accessing All Data Categories Associated with an sObject.
The following table lists all the methods available as part of the data category group structure describe result. None of the methods take an argument.
| Name | Return Type | Description |
|---|---|---|
| getDescription | String | Returns the description of the data category group |
| getLabel | String | Returns the label for the data category group used in the Salesforce user interface |
| getName | String | Returns the unique name used by the API to access to the data category group |
| getSobject | String | Returns the name of object associated with the data category group |
| getTopCategories | List<Schema.DataCategory> | Returns a Schema.DataCategory object, that contains the top categories visible depending on the user's role category group visibility settings. For more information on category group visibility, see “About Category Group Visibility” in the Salesforce online help. |
A Schema.DataCategory object represents the categories within a category group. The Schema.DataCategory object is returned by the getTopCategories method. The following table lists all the methods for the Schema.DataCategory object. None of these methods take an argument.
| Name | Return Type | Description |
|---|---|---|
| getChildCategories | List<Schema.DataCategory> | Returns a recursive object that contains the visible sub categories in the data category |
| getLabel | String | Returns the label for the data category used in the Salesforce user interface |
| getName | String | Returns the unique name used by the API to access to the data category |