
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 02:01 AM
Hi,
When looking at a list view of unpublished knowledge articles, 'system' appears many times as the author. This is because the knowledge articles are auto created from a BR when an incident is closed (and majority of our incs are resolved manually and closed automatically after x days). So I am trying to script up the following if its possible - if the author of an article is 'system' and/or the source is an incident number, make the author the 'resolved by' user from the incident.
From reading various community posts I wasnt sure if I needed a custom field on KB, so I created u_creator, and wrote the following, but all its doing is setting the sys id of the system administrator against every article regardless of whether they were generated from an incident or written as new. I think I need a few scripting tips please!
on after BR on Incident table
Condition = State changes to closed
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('kb_knowledge');
gr.addQuery('incident',current.sys_id);
while(gr.next())
{
gr.u_creator = current.resolved_by;
gr.update();
}
})(current, previous);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 02:16 AM
Hello,
Please modify the Incident OOB Business rule "Incident Create Knowledge" which creates the knowledge article and then set the author in it. Add the following line before you insert or create a knowledge article.
kb.author = current.resolved_by;
This should fix your issue permanently instead of a adding a custom and duplicate field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 02:10 AM
Hi,
This can happen due to various reasons, couple of them are
- There is a timer activity in your workflow which changes the script context from user to system on incident.
- The schedule script which you are running to resolve the incident is running as system.
You need to fix that and this will get automatically fixed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 02:16 AM
Hello,
Please modify the Incident OOB Business rule "Incident Create Knowledge" which creates the knowledge article and then set the author in it. Add the following line before you insert or create a knowledge article.
kb.author = current.resolved_by;
This should fix your issue permanently instead of a adding a custom and duplicate field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 02:50 AM
Thanks Ali, never even thought of that