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

johnram
ServiceNow Employee
ServiceNow Employee

The ServiceNow Wiki content is no longer supported. Updated information about this topic is located here: Metrics



 


Visit http://docs.servicenow.com for the latest product documentation


rbaig
Kilo Contributor

Thank you both for the response. I am looking for a specific field where the assignment time/stamp is recorded.


I need this field to be     added to list.


Can this is done using Metric definition.




Like as we have in the activity.


Where the timestamp is displayed when a ticket is assigned from one group to another.Assignment group timestamp.JPG


Are you looking to have a column like "Assigned on" in the Incident List View that shows when the Assignment Group was set, along with all other Incident columns? Just wan to confirm when you say "list" you mean the Incident List or some other list.


rbaig
Kilo Contributor

Hi John,



Yes, you are right. I am looking for a column to add on Incident List View.


There are a few possibilities:



  1. Create a database view joining incident and sys_audit. CAVEAT: this will give you ALL changes to assignment_group, resulting in multiple rows (each row for reassignment) per an incident record.
  2. Create a metric as Abhinay suggested and create a database view. CAVEAT: metrics will be populated only going forward, not retroactively.
  3. Use Performance Analytics
  4. Add a column to incident table and add a BR that populates the field when assignment_group changes. CAVEAT: This will only capture the field value going forward, not retroactively (unless you write a script to populate this retroactively)


Do you know which one might be your preference?