Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var categoriesList = [];

function GetAllTheCategoriesRelatedToAKnowledgeBase(parentID, categoriesList) {

if (!parentID)
return;

var catGr = new GlideRecord('kb_category');
catGr.addQuery('parent_id', parentID);
catGr.query();
while (catGr.next()) {
categoriesList.push(catGr.getValue('sys_id'));
gs.info(catGr.getValue('label'));
GetAllTheCategoriesRelatedToAKnowledgeBase(catGr.getValue('sys_id'), categoriesList);
}
return categoriesList;

}
gs.info(GetAllTheCategoriesRelatedToAKnowledgeBase('a7e8a78bff0221009b20ffffffffff17' /*replace with your Knowledge Base Sysid*/ , categoriesList));
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Use case: there is no field on the Knowledge category table which points back to the Knowledge base it belongs to.

To find the all the related categories of a knowledge base use this script.

This script Recursively go through categories and pull the related categories.
Loading