Reporting on flagged field in knowledge management

mohammedunwala
Giga Contributor

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

1 ACCEPTED SOLUTION

This would give you the date the article was flagged. It creates a new entry when articles are flagged, rated, commented, etc.



find_real_file.png



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.


View solution in original post

13 REPLIES 13

Yeah.. I'll post something soon.


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:



find_real_file.png



The resultant email:


find_real_file.png



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.


Chuck Tomasi
Tera Patron

I'd do a scheduled report on the table kb_feedback. The rating field will tell you how people voted with the stars.


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


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.