Attach Technical KB Article to incident in SOW to auto populate in work_notes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2025 03:32 AM
Hello,
I have a requirement for the work notes to be auto populated instead of additional comments field when a KB article that is not "Public" is attached to an incident in SOW. This is to prevent end users from having access to KAs that are not "Public".
I tried amending the search action "attach", however this applied to all KBS.
I would like to know if there is a way to separate which KB article could be be populated in additional comments and others in work notes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2025 08:00 AM
Hi @Kelvin-KenA2855,
Do I understand it correctly - if KB article is related to an incident, then a comment shall be automatically added? Would that be for all articles or any?
It could be somehow done via BR, flow designer or client script (onChange).
Please confirm the exact scenario
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 04:03 AM
Hi @GlideFather ,
Thank you for your response.
By default if a KB article is attached to an incident in SOW, the link to the articles is auto populated to 'additional comments' field. However, the customer wants only KB articles that are 'Public' attached to auto populate to 'additional comments' while articles that are classified 'Technical knowledge' should auto populate to 'work_notes' field. I have tried a BR but it has not worked.
See BR:
(function executeRule(current, previous /*null when async*/) {
// Check if the KBA is being attached to an incident
var taskGr = new GlideRecord('task_knowledge');
taskGr.addQuery('knowledge', current.sys_id);
taskGr.addQuery('task.table', 'incident');
taskGr.query();
if (taskGr.next()) {
var incidentGr = new GlideRecord('incident');
if (incidentGr.get(taskGr.task)) {
// Get the KB sys_id
var kbSysId = current.kb_knowledge_base;
// Replace 'PUBLIC_KB_SYS_ID' with the actual sys_id of the Public KB
if (kbSysId == 'PUBLIC_KB_SYS_ID') {
// Attach to additional_comments
incidentGr.additional_comments = 'Attached Knowledge Article: ' + current.number + '\n' + current.short_description + '\nLink: ' + gs.getProperty('glide.servlet.uri') + 'kb_view.do?sysparm_article=' + current.number;
} else {
// Attach to work_notes for other KBs
incidentGr.work_notes = 'Attached Knowledge Article: ' + current.number + '\n' + current.short_description + '\nLink: ' + gs.getProperty('glide.servlet.uri') + 'kb_view.do?sysparm_article=' + current.number;
}
incidentGr.update();
}
}
})(current, previous);