Reporting On Hold average time for a given Assignment Group

Paula Alejandra
Mega Guru
Mega Guru

Hi,

 

I need to create a report to exhibit some statistics related to TWO SIMULTANEOUS conditions:

 

State = On Hold

Assignment Group = XYZ

 

Incident Metric table as is won't help me, since the Definition Values I need are separated from each other. I am starting to thinking that a NEW Definition [Scripted] my be the solution but wouldn't want to go that waiy if there's something already in place that I am not seeing / not aware of.

 

Any ideas or suggestions on how to approach this?

 

Thanks in advance,

Paula Alejandra Portal
CSA - CIS PA
1 ACCEPTED SOLUTION

Bert_c1
Kilo Patron

You are welcome, I'm glad I was able to help.  You can use an "After" business rule defined on the incident table, with condition: "Assignment group", "changes from", "Hardware" (ABC in your example). with Advanced checked and script:

 

closeMetric('c06cbfdf477b6110753923dbd36d43a8', current.sys_id);

function closeMetric(def_sys_id, inc_sys_id) {
//	var mir = m_i.metricExists(); just returns T/F, so query for existing record
	var gmr = new GlideRecord('metric_instance');
    gmr.addQuery("id", inc_sys_id);
    gmr.addQuery("definition", def_sys_id);
	gmr.addQuerry('value', 'On Hold');
    gmr.query();
//	gs.info("groupOnHoldDuration: closeMetric: found: " + gmr.getRowCount() + " records for id: " + inc_sys_id);
	if (gmr.next()) {
		gmr.end = new GlideDateTime();
		gmr.duration = gs.dateDiff(gmr.start.getDisplayValue(), gmr.end.getDisplayValue());
		gmr.calculation_complete = true;
//		gs.info("groupOnHoldDuration: closeMetric: setting end: " + gmr.end);
		gmr.update();
	}
}

 

Good luck.

View solution in original post

5 REPLIES 5

Bert_c1
Kilo Patron

Hi LuisMarcel,

 

the metric definition works as long as the assignment_group doesn't change while the 'incident_state' remains On-Hold. To stop the metric when the assignment_group changes, the BR logic is needed. The interested group should not be impacted by On-Hold duration when another group has the incident.