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
1 change: 1 addition & 0 deletions Business Rules/Replace KB Author with Manager/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This business rule help to replace the KB author of knowledge article to Knowledge base manager, if the author of that article leaves the organization. This is a kind of logic which helps to assign the knowledge article to knowledge base manager.
19 changes: 19 additions & 0 deletions Business Rules/Replace KB Author with Manager/Replace Script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(function executeRule(current, previous /*null when async*/ ) {
var test_kb_manager;
var test_arr_kb_manager;
if (active == false) { // This will check if user is inactive.
var kb_gr = new GlideRecord("kb_knowledge");
kb_gr.addEncodedQuery("author=" + current.sys_id); // This will query the knowledge article.
kb_gr.query();
while (kb_gr.next()) {
if (test_kb_manager != "") {
test_kb_manager = kb_gr.kb_knowledge_base.kb_manager;
test_arr_kb_manage = test_kb_manager.split(","); // This will seperate the list of manager by (,).
kb_gr.author = test_arr_kb_manager[0]; // This will assign the article author to knowledge manager.
kb_gr.update();

}
}
}

})(current, previous);