Skip to content

Commit 312f2f0

Browse files
authored
Merge pull request #2102 from LakshmiChaitanyaReddy/Chaitanya-ILCR-Code-Snippets-v5
Chaitanya ilcr code snippets v5
2 parents 4675edb + 84035f6 commit 312f2f0

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var categoriesList = [];
2+
3+
function GetAllTheCategoriesRelatedToAKnowledgeBase(parentID, categoriesList) {
4+
5+
if (!parentID)
6+
return;
7+
8+
var catGr = new GlideRecord('kb_category');
9+
catGr.addQuery('parent_id', parentID);
10+
catGr.query();
11+
while (catGr.next()) {
12+
categoriesList.push(catGr.getValue('sys_id'));
13+
gs.info(catGr.getValue('label'));
14+
GetAllTheCategoriesRelatedToAKnowledgeBase(catGr.getValue('sys_id'), categoriesList);
15+
}
16+
return categoriesList;
17+
18+
}
19+
gs.info(GetAllTheCategoriesRelatedToAKnowledgeBase('a7e8a78bff0221009b20ffffffffff17' /*replace with your Knowledge Base Sysid*/ , categoriesList));
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Use case: there is no field on the Knowledge category table which points back to the Knowledge base it belongs to.
2+
3+
To find the all the related categories of a knowledge base use this script.
4+
5+
This script Recursively go through categories and pull the related categories.

0 commit comments

Comments
 (0)