Latest Assignment Date/Time stamp on Incident Table

rbaig
Kilo Contributor

We have to run some reports based on incoming tickets for an assignment group by month.

I don't see an OOTB field on Incident table which captures Assignment date/time stamp.

There is only opened field, but the requirement is on assigned to group date/time stamp.

Please help on same.

Thank you

1 ACCEPTED SOLUTION

For the BR script, if the Assignment Group ever gets blanked out, your "if" statement will skip that event. If that's not what you meant, you may need to remove the "if".



For retroactively filling in the new column value, you'd use GlideAggregate like below (not tested):



var ga = new GlideAggregate('sys_audit');


ga.addAggregate('MAX', 'sys_created_on');


ga.groupBy('documentkey');


ga.addQuery('tablename', 'incident');


ga.query('fieldname', 'assignment_group');


while (ga.next()) {


  var sys_id = ga.documentkey;   // sys_id of incident


  var assigned_on = ga.getAggregate('MAX', 'sys_created_on');   // last time assignment_group changed


  var gr = new GlideRecord('incident');


  if (gr.get(sys_id)) {   // find incident record


      gr.u_assigned_on = assigned_on;   // set value


      gr.update();


  }


}



Now that you're capturing this value in a field, you won't need that as a metric any more but use if for other metrics such as



  • Duration between Opened and Last Assigned
  • Duration between Last Assigned and Resolved


These in conjunction with reassignment_count and other metrics may provide valuable insights.



Again, if you ever need to see all reassignment history, you can use the very first solution I provided using sys_audit,


View solution in original post

16 REPLIES 16

drjohnchun
Tera Guru

Please see my answer to the post Is there a way to see who has been assigning incidents to individuals (based on new unassigned ticke... You can use a similar filter, but use Field name is assignment_group.



find_real_file.png



Hope this helps.



Please feel free to connect, follow, mark helpful / answer, like, endorse.


John Chun, PhD PMP see John's LinkedIn profile

visit snowaid


ServiceNow Advocate

Winner of November 2016 Members' Choice Award


Abhinay Erra
Giga Sage

See metrics for this. You can create your own metric definition.


Metric Definition Support - ServiceNow Wiki


Hello Abhinay,



Thank you, I referred this section it is really helpful.    


As I mentioned you will have to consider building your own metric definition and pulling the reports on them.