Newer Version Available

This content describes an older version of this product. View Latest

describeDataCategoryGroups()

Retrieves available category groups for objects specified in the request.

Syntax

1DescribeDataCategoryGroupResult[] = connection.describeDataCategoryGroups()(string[] sObjectTypes);

Usage

Use this call to describe the available category groups for the objects specified in the request. This call can be used with the describeDataCategoryGroupStructures() call to describe all the categories available for a specific object. For additional information about data categories, see “Data Categories in Salesforce.com” in the Salesforce online help.

Sample Code—Java

This sample shows how to retrieve the data category groups associated with:
  • Salesforce Knowledge articles
  • Questions from the Answers feature
It returns the name, label and description of a category group and the name of the associated sobject (article or question). It also returns the number of data categories in the data category group.
1public void describeDataCategoryGroupsSample() {
2    try {
3        // Make the describe call for data category groups
4        DescribeDataCategoryGroupResult[] results =
5            connection.describeDataCategoryGroups(new String[] {
6                "KnowledgeArticleVersion", "Question"});
7        
8        // Get the properties of each data category group 
9        for (int i = 0; i < results.length; i++) {
10          System.out.println("sObject: " + 
11              results[i].getSobject());
12          System.out.println("Group name: " + 
13              results[i].getName());
14          System.out.println("Group label: " + 
15              results[i].getLabel());
16          System.out.println("Group description: " +
17              (results[i].getDescription()==null? "" : 
18                  results[i].getDescription()));
19          System.out.println("Number of categories: " + 
20              results[i].getCategoryCount());              
21        }
22      } catch (ConnectionException ce) {
23        ce.printStackTrace();
24    }
25}

Sample Code—C#

This sample shows how to retrieve the data category groups associated with:
  • Salesforce Knowledge articles
  • Questions from the Answers feature
It returns the name, label and description of a category group and the name of the associated sobject (article or question). It also returns the number of data categories in the data category group.
1public void describeDataCategoryGroups() {
2    try {
3        // Make the describe call for data category groups
4        DescribeDataCategoryGroupResult[] results =
5            binding.describeDataCategoryGroups(new String[] {
6                "KnowledgeArticleVersion", "Question"});
7            
8        // Get the properties of each data category group 
9        for (int i = 0; i < results.Length; i++) {
10            Console.WriteLine("sObject: " + 
11                results[i].sobject);
12            Console.WriteLine("Group name: " + 
13                results[i].name);
14            Console.WriteLine("Group label: " + 
15                results[i].label);
16            Console.WriteLine("Group description: " +
17                (results[i].description==null? "" : 
18                    results[i].description));
19            Console.WriteLine("Number of categories: " + 
20                results[i].categoryCount);              
21        }
22        } catch (SoapException e) {
23            Console.WriteLine("An unexpected error has occurred: " +
24                    e.Message + "\n" + e.StackTrace);
25    }
26}

Arguments

Name Type Description
sObjectTypes string[] The specified value can be:
  • KnowledgeArticleVersion—to retrieve category groups associated with article types.
  • Question—to retrieve category groups associated with questions.

For additional information about articles and questions, see “Work with Articles and Translations” and “Answers Overview” in the Salesforce online help.