---
schema_version: "1"
id: 910406ce9ae5e53ddef74877b229a246de252b1dcbdf79a3a74b12a45e52f7f7
title: DataCategory Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_Schema_DataCategory.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_DataCategory.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 6d2691281046b7950ccc93c2a3cb1d4efecba65566e63da82887a7b835ff08ac
description: Represents the categories within a category group.Returns a recursive object that contains the visible sub categories in the data category.Returns the label for the data category used in the Salesforce user interface.Returns the unique name used by the API to access to the data category.
---
# DataCategory Class

Represents the categories within a category group.

## Namespace

[Schema](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_Schema.htm "The Schema namespace provides classes and methods for schema metadata information.")

## Usage

The Schema.DataCategory object is returned by the getTopCategories method.

## DataCategory Methods

The following are methods for DataCategory. All are instance methods.

- **[getChildCategories()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_DataCategory.htm#apex_Schema_DataCategory_getChildCategories)**  
    Returns a recursive object that contains the visible sub categories in the data category.
- **[getLabel()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_DataCategory.htm#apex_Schema_DataCategory_getLabel)**  
    Returns the label for the data category used in the Salesforce user interface.
- **[getName()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Schema_DataCategory.htm#apex_Schema_DataCategory_getName)**  
    Returns the unique name used by the API to access to the data category.

### getChildCategories()

Returns a recursive object that contains the visible sub categories in the data category.

#### Signature

public Schema.DataCategory getChildCategories()

#### Return Value

Type: [List](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_list.htm#apex_methods_system_list "Contains methods for the List collection type.")<[Schema.DataCategory](#apex_class_Schema_DataCategory "Represents the categories within a category group.")\>

### getLabel()

Returns the label for the data category used in the Salesforce user interface.

#### Signature

public String getLabel()

#### Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### getName()

Returns the unique name used by the API to access to the data category.

#### Signature

public String getName()

#### Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")