DataCategoryGroup defines a hierarchical taxonomy: a tree of categories used to classify and filter articles or questions and support sharing through category visibility. Its required active flag records whether the group is active.
The group contains category definitions and object associations. It is distinct from the records that assign individual articles or questions to categories, and its hierarchy alone does not establish a user's effective category access.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
Required component identifier, inherited from Metadata. When creating the group, it must match the file name without its suffix. |
active |
Required boolean: true means active; false means inactive. |
label |
Required user-interface text. The group has a label, and each nested category has its own label. A category label is not its API identifier. |
dataCategory |
At group level, the single required top-level category. Within a category, this element recursively contains a list of subcategories. The group supports up to 100 categories and five hierarchy levels. |
name |
Required developer identifier within each nested DataCategory. It is defined once and cannot be changed later. Replacing it causes deletion and addition, not a rename. |
objectUsage |
Contains the group's object associations. Deploying an existing group permanently removes associations omitted from this structure. |
object |
List within objectUsage. Documented values are KnowledgeArticleVersion for articles and Question for questions. Question can belong to at most one category group. |
Behavior and Constraints
Category identity and display text are separate. Nested categories use name for API identity and label for display text. Changing a label must not be confused with replacing the category's name.
The group's fullName must be unique, start with a letter, and contain only alphanumeric characters and underscores. It cannot contain spaces, end with an underscore, or contain consecutive underscores.
Moving a category can change access. Users who have no visibility to its new parent lose visibility to the repositioned category. To determine who is affected, inspect users' actual category visibility assignments; neither the hierarchy nor active alone establishes effective access.
objectUsage associates an eligible object with the taxonomy so its records can be classified and filtered. It does not assign individual records to categories. Although this association is represented as a CustomObject reference, the documented values do not make it a general-purpose association for arbitrary custom objects.
For XML structure, the Metadata API definition specifies one required group-level dataCategory and one objectUsage structure containing an object list. Some metadata tooling exposes both outer elements as arrays. That representation differs from the API definition, which places repetition in the nested category list and the object list.
Deployment and Retrieval
Each group is stored in a separate file with the suffix .datacategorygroup in the datacategorygroups directory. The type supports the * wildcard in the package.xml manifest. When creating a group, its fullName must match the file's base name.
Deploying an existing group reconciles it against the supplied XML; it is not an additive patch. Metadata API creates a group if it does not exist. For an existing group, it:
- Adds new categories and object associations included in the XML.
- Permanently deletes categories omitted from the XML and re-associates their records with the parent category.
- Permanently removes object associations omitted from
objectUsage. - Moves existing categories whose hierarchical positions differ from the XML.
A partial definition can therefore remove production categories and change record categorization even when the intended change is only an addition. Salesforce recommends manually creating categories and record associations through Data Categories in Setup rather than deploying these changes from a sandbox to production. See the deployment usage guidance.
Replacing a category name does not preserve its assignments
If production contains US beneath AMER, and the deployed XML replaces it with USA at the same position, deployment deletes US and creates USA. Records previously assigned to US move to AMER, not to USA.
Matching hierarchies can have different record classifications
Deployment does not replay the sequence of edits made in the source org. For example, suppose a sandbox adds EU beneath EMEA, moves FR beneath EU, and then deletes FR. Its records can end up assigned to EU in the sandbox.
When the resulting XML is deployed to production, the deleted category's records can instead move to its original production parent, EMEA. The final category trees can match while record classifications differ.
Retrieve record assignments separately from the taxonomy
Do not treat the group XML as an export of article category assignments. For Lightning Knowledge migration or diagnosis, inspect article-version category selections separately. The reported workflow using Knowledge__DataCategorySelection is described under Reported Issues.
Relationships
The group's object association connects the taxonomy to eligible records. Reports can consume the group through a reference; they are not components contained in the group. Nested DataCategory definitions remain part of the group's structure.
References
-
CustomObject:objectwithinobjectUsage. The documented values are limited toKnowledgeArticleVersionandQuestion.
Referenced By
-
Report:dataCategoryGroup.
Reported Issues
-
Article assignment migration requires separate record operations. A 2020 Lightning Knowledge answer describes querying and inserting
Knowledge__DataCategorySelectionrecords usingParentId,DataCategoryGroupName, andDataCategoryName. In that workflow,ParentIdidentifies aKnowledge__kavarticle version, not the metadata group or category. This concerns runtime record assignments, not nested category definitions. See the Lightning Knowledge assignment workflow. -
A group retrieval may not account for category visibility settings. In a 2020 discussion about missing visibility information after retrieving groups, profiles, permission sets, and roles, an answer directed the user to
Profilemetadata and reported thatPermissionSetmetadata did not expose category visibility. Treat this as a reported retrieval limitation, not as proof of a user's effective access. See the visibility retrieval discussion. - Categories can be created through metadata rather than only through Setup. A 2016 respondent reported retrieving a group, generating additional category XML, adding it to the group file, and deploying it successfully. This supports metadata-based creation, but does not remove the reconciliation risks described above. See the category creation report.
Common Questions
Will deploying a DataCategoryGroup delete categories missing from my XML?
Yes. For an existing group, categories omitted from the deployed XML are permanently deleted, and their records are re-associated with the parent category. Omitted object associations are also permanently removed.
Can I rename a data category by changing its name element?
No. A category's name is immutable. Replacing it is a deletion and an addition, and the old category's assignments move to its parent rather than to the new category. The label is separate display text.
Why do sandbox and production have the same hierarchy but different article categories?
Deployment applies the final XML rather than replaying sandbox edits. If a category was moved and then deleted in the sandbox, production records can move to its original production parent instead of the parent it had before deletion in the sandbox.
Does DataCategoryGroup migrate Lightning Knowledge article assignments?
The group defines the taxonomy and object associations, not individual article assignments. The reported Lightning Knowledge workflow handles assignments separately through Knowledge__DataCategorySelection, with ParentId pointing to a Knowledge__kav article version.
Why did users lose category visibility after I moved a category?
Users without visibility to the new parent lose visibility to the moved category. Inspect their actual category visibility assignments; the group's hierarchy and active flag alone do not establish access.