describeDataCategoryGroups()

Retrieves available category groups for objects specified in the request.

Syntax

DescribeDataCategoryGroupResult[] = 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 “What are Data Categories?” in the Salesforce online help.

Sample Code—Java

This example shows how to retrieve the category groups associated with:
  • Salesforce Knowledge articles
  • Questions from the Answers feature
The code 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.
public void describeDataCategoryGroups() {
  try {
    DescribeDataCategoryGroupResult[] results =
        connection.describeDataCategoryGroups(new String[] {
            "Account", "Lead"
        });
    for (int i = 0; i < results.length; i++) {
      System.out.println("sObject: " + 
          results[i].getSobject());
      System.out.println("Group name: " + 
          results[i].getName());
      System.out.println("Group label: " + 
          results[i].getLabel());
      System.out.println("Group description: " +
          results[i].getDescription());
      System.out.println("Category count: " + 
          results[i].getCategoryCount());
    }
  } catch (ConnectionException ce) {
    ce.printStackTrace();
  }
}

Sample Code—C#

This example shows how to retrieve the category groups associated with:
  • Salesforce Knowledge articles
  • Questions from the Answers feature
The code 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.
private void describeDataCategoryGroupsSample()
{
    try
    {
       DescribeDataCategoryGroupResult[] results =
               binding.describeDataCategoryGroups(
                   new string[] {
                       "KnowledgeArticleVersion",
                       "Question"
                   }
               );
        for (int x=0;x<results.Length;x++)
        {
           DescribeDataCategoryGroupResult categoryGroup =
               results[x] 
    ;
           
           // Get the name of the associated SObject 
    
           string sObject = categoryGroup.getSobject();
           Console.WriteLine("sObject: " + sObject);
           
           // Get the name of the data category group 
    
           string dataCategoryGroupName =
                               categoryGroup.getName();
           Console.WriteLine("Group name: " + dataCategoryGroupName);
           
           // Get the label of the data category group 
    
           string dataCategoryGroupLabel =
                               categoryGroup.getLabel();
           Console.WriteLine("Group label: " + dataCategoryGroupLabel);
           
           // Get the description of the data category group 
    
           string dataCategoryGroupDescription =
                               categoryGroup.getDescription();
           Console.WriteLine("Group description: "
               + dataCategoryGroupDescription);
 
           // Get the count of the data categories in the data 
    
           // category group structure 
    
           int dataCategoryCount =
                               categoryGroup.getCategoryCount();
           Console.WriteLine("Category count: " + dataCategoryCount);
        }
    } catch (Exception ex) {
       Console.WriteLine("\nFailed to get data category group descriptions.");
        Console.WriteLine(ex.Message);
       Console.WriteLine(ex.StackTrace);
    }
}

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 “Managing Articles and Translations” and “Answers Overview” in the Salesforce online help.

Response

DescribeDataCategoryGroupResult

Faults

InvalidSObjectFault

UnexpectedErrorFault

© Copyright 2000–2012 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.