How "kb_category" table is associated with "kb_knowledge_base" table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2015 08:48 AM
We're currently working on a servicenow project involving customization of a category and subcategory field on "kb_knowledge" table to store data instead of using the OOB category field(OOB category field is required not visible when select the specified internal knowledge base).
While in order to display the category strcture in other places by using the OOB category functionality, we have to copy the customized subcategory value into the OOB category field, so we create a business rule on "kb_knowledge" to make this happen:
script like below, current table stands for "kb_knowledge", the function will be triggerred when we select the specified knowledge base:
function onBefore(current, previous) {
//This function will be automatically called when this rule is processed.
var kb_category_value = current.u_internal_kb_sub_category;
var cat = new GlideRecord('kb_category');
cat.addQuery('label', kb_category_value);
cat.orderBy('sys_updated_on');
cat.query();
while(cat.next()) {
current.kb_category = cat.sys_id;
}
}
But now we find an issue, say if there are two same subcategory value in "kb_category", e.g. "Administer Leave", which belong to two different knowledge base. Then above query will unable to retrive the correct record.
I think the best way to fix it is to add two conditions in the copy script.
1. Check and find record label = "Internal subcategory" in "kb_category" table (the script already done)
2. Check and match record in "kb_category" table's knowledge base value is same with knowledge article's knowledge base value
Unfortunately, I am unable to find how "kb_category" table is associated with "kb_knowledge_base" table, looks like Parent ID is not the one we want.
Can anyone pls advise ? Thanks.
- Labels:
-
Knowledge Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2015 09:47 AM
Ni Hao weiwei,
(this answer assumes you're on Fuji)
Doing this through the Category / Category Parent ID is going to be difficult, because Parent ID can relate to *either* a Knowledge Base *or* a Category. This is how you're able to have a KB with one layer of records and a KB you can drill into until your finger falls off. There's no way of knowing how many tiers are between a category and a knowledge base unless you want to get into some real fancy iterations.
I propose 2 alternatives:
1) Ditch internal 2 tier categories / adopt Fuji's multi-tier categories
This will allow each Knowledge stakeholder the ability to taxonomize in a tiering system that's most appropriate to them... whether that's 1 or 5 tiers.
2) Ditch Categorization and use Tags
Unless you run reports on Knowledge category utilization *AND* change operational behaviors based on report results, categorization only provides the illusion of structure. Twitter teaches us that billions of messages can be posted per day, knowledge can be gleaned, and value delivered with absolutely no thought to a nested hierarchy of topics.