- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 07:37 AM
Hi All,
We have a requirement to report flagged article to service desk at the end of every business day. Another requirement is to check and send the email only if there are articles that were flagged that day.
Proposed solution:
I was thinking of creating a custom date field called "Flagged date" on the knowledge table and update that date to current whenever an article is flagged. Then create a scheduled report with conditions 'Article Flagged = True' and 'Flagged Date = today' and run that report every night so that the system sends the list of articles flagged (if any) on that day to service desk.
My question to you all developers is this the right solution for this type of requirement? or is there a better, easier solution?
Also, I am new to scripting so not sure how will i set the custom field to update when the article is flagged?
Any help would be greatly appreciated.
Thanks,
Mohammed
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 01:18 PM
This would give you the date the article was flagged. It creates a new entry when articles are flagged, rated, commented, etc.
No scripting needed. Schedule that and check the box that says "Don't send if empty" (or something like that). I think that meets your requirements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 09:38 AM
Yeah.. I'll post something soon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 12:01 PM
Ok, the notification email script:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
template.print("<p></p>Flagged Articles:<br />");
var flag = new GlideRecord('sys_history_line');
flag.addEncodedQuery('label=Flagged^new=true^update_timeONToday@javascript:gs.daysAgoStart(0)@javascript:gs.daysAgoEnd(0)');
flag.query();
while(flag.next()){
template.print(flag.set.id.number + ": " + flag.update_time + "<br />");
}
})(current, template, email, email_action, event);
the email notification when event is fired:
The resultant email:
Of course, add styling and spacing and whatever and you have a very basic email that you can schedule the event (schedule a run script: gs.eventQueue) and it will send it out every night upon your schedule.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 07:55 AM
I'd do a scheduled report on the table kb_feedback. The rating field will tell you how people voted with the stars.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 07:59 AM
Hi Chuck,
We are not using the star rating feedback functionality. And the requirement is the ability to send service desk with the list of flagged article at the end of that business day. Maybe I wasn't clear with the ask here.
Does it makes sense now?
Thanks,
Mohammed

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 08:01 AM
OK, sorry. Use the flagged field to report on from the kb_feedback table. To get "today's" records, use the sys_created_on date/time field to filter out just those records.