Loading

Update or Assign Salesforce Knowledge Article 'data categories' via Data Loader

Julkaisupäivä: Aug 8, 2025
Kuvaus

Updating article data category assignment via the API is not possible. However, it is possible to delete existing data category assignments and insert or assign new categories to articles via the API using a client tool such as Salesforce Data Loader.

Administrators may consider manipulating existing Article Type__DataCategorySelection records by exporting existing assignments, deleting them, and then preparing a file to insert only their desired category assignments for articles to effectively achieve the same result as a mass update.

Notes:

  • Users can only access, create, or delete article data category selections that are visible to their role, permission set, or profile via the API. Be sure that the User performing this operation has visibility to all Data Category Groups and Categories.
  • As of Spring 20, the maximum number of data categories that can be linked to an article can ‌now be up to 50 so that you can catalog articles more accurately. For more information, please see the 'Find and Organize Articles with More Data Categories' section on the Salesforce Spring ’20 Release Notes.
 
Ratkaisu

 

Warning

Always back up your data before performing any data operation. See Export Backup Data from Salesforce or Export Data for more details. It is highly recommended to attempt the following steps in a sandbox or other test environment and then with a small subset of records in production to ensure the operation was successful through manually opening and verifying that the corresponding records are correct in Salesforce.
 


1. Export your existing DataCategorySelection records for each article type

 
  1. Open Data Loader and click Export | Login | Next
  2. In 'Step 2: Select Data Objects' select Show all Salesforce objects and locate your desired Article Type's Data Category Selection object.
 
For example, an article type with the name "Documentation" would show up in the list of objects as:
Data Category Selection: Documentation (Documentation__DataCategorySelection)

Click Browse... and choose a file name and location to save the export file on your local machine then click on Next.
 
  1. In 'Step 3: Edit your Query' click Select all fields then Finish. Then click Yes on the pop-up prompt.
 
Note: Be sure to keep an unaltered version of this export's file for your records and backup.

 

2. Delete the exported and existing DataCategorySelection records:

 
Note: This step is not required if you're only adding new assignments however, if you're updating it may be easier to delete existing article data category assignments and start with a 'clean slate' to ensure that only the assignments you specify in your file are applied to existing articles. If a Data Category is already assigned to an Article the insert for that row will fail with the error: duplicate value found: <unknown> duplicates value on record with id: <unknown>
 
 
  1. Open Data Loader and click on Delete
  2. In 'Step 2: Select Data Objects' select Show all Salesforce objects and locate the article type's Data Category Selection object. Click Browse... and choose the previously exported file on your local machine. Click Next.
  3. In 'Step 3: Mapping' click Create or Edit a Map then Auto-Match Fields to Columns and confirm that the Id field is properly mapped to the ID column from your file. Click OK and then Next.
  4. In 'Step 4: Finish' click Browse... and choose a file name and directory on your local machine to save the success and error files. Click Finish. Click Yes on both prompts that will appear.

 

3. Prepare a file to insert your desired Data Category Assignments for articles

 

Note: This process requires manual creation of a new file or manipulation of your export file and you'll need to ensure that you have created a unique row for each data category you would like to assign to each article. Using Article Type__DataCategorySelection to classify an article, you can't select both a category (for example USA) and one of its descendants (California) or ascendant categories (North America). In this case, only the first category is selected.

 

  1. Create a .csv file with the following column headers:
  • ParentId - Id of the article associated with the data category selection. It's possible to generate a list of Article Ids by running an export or query against the KnowledgeArticleVersion object and selecting to include the Id field.
 
  • DataCategoryGroupName - Unique name of the data category group which has categories associated with the article.
 
  • DataCategoryName - Unique name of the data category associated with the article. To review available category groups and categories or adjust your existing data category structure, navigate to Setup, enter Data Category in the Quick Find box, then select Data Category Setup. To find unique names double click on the desired group or category. For more details see Modify and Arrange Data Categories.

 

  1. Once you're satisfied with your file, open Data Loader and click Insert.
  2. In 'Step 2: Select Data Objects' select Show all Salesforce objects and locate the article type's Data Category Selection object. Click Browse... and choose your insert file. Click Next and verify if the record count from your .csv file is correctly shown, then click OK.
  3. In 'Step 3: Mapping' click Create or Edit a Map then Auto-Match Fields to Columns and confirm that each field is properly mapped to the your insert file's columns. Click OK then Next.
  4. In 'Step 4: Finish' click Browse... and choose a file name and directory on your local machine to save the success and error files. Click Finish. Click Yes on both prompts that will appear.
Knowledge-artikkelin numero

000382462

 
Ladataan
Salesforce Help | Article