- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2016 05:10 PM
My goal is to be able to come up with an incident report for each user where I can see incidents that they have modified in the last 48 hours. Problem is with the current incident fields this doesn't seem possible. You can search on an updated last 48 hours filter, however the updated by will always be the latest user to update an incident so if a different user touched the incident before that there doesn't seem to be a way to accomplish this in an incident report. I was thinking of doing a report on the audit table, or even just running a script that pulls the data, but trying to query sys_audit in any fashion seems to be a horrible idea and I have to cancel the transaction before it just endlessly runs.
Does anyone know of a way to grab the data I am looking for here? Is sys_audit my only option?
Best regards,
Brian
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2016 06:13 AM
Definitely reporting on sys_audit is almost impossible, but you can use Metrics to get your answers. There is a little setup involved, but it works nice.
Step 1: create new Metric, on Incident table, with Type Script Calculation but leave Script area blank. Field doesn't matter but note sys_id of new Metric.
Step 2: create a before business rule on Incident table like below
Step 3: add the following script in the advanced section of your BR. Update the 2 sys_ids of var MetricSysID to match your Metric from Step 1
{
//sys id of the metric definition
var metricSysID = '3c9eb5770f4a9600c2498f8ce1050ea5';
var mi= new GlideRecord('metric_instance');
mi.addQuery('id',current.sys_id);
mi.addQuery('definition',metricSysID);
mi.query();
//if mi.next will insert another if exists.
//if !mi.next, will insert new entry
if(!mi.next()){
insertMetrics();
}
// since !mi.next inserts new, this will insert updates.
else if(current.active == true && current.operation() == 'update'){
insertMetrics();
}
}
function insertMetrics() {
var mi= new GlideRecord('metric_instance');
//sys id of the metric definition
var metricSysID = '3c9eb5770f4a9600c2498f8ce1050ea5';
mi.initialize();
mi.definition = metricSysID;
mi.start = previous.sys_updated_on;
mi.end = gs.nowDateTime();
mi.duration = gs.dateDiff(mi.start, mi.end);
mi.id = current.sys_id;
mi.value = gs.getUser().name;
mi.calculation_complete = true;
mi.insert();
}
gs.log('Metric trigger');
Step 4: (last one) Build a report of the newly captured data. (Doesn't not work on existing data, just new data after this is implemented
It might seem like a lot but screen shots are better than a bunch of words!
I use this all the time.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2016 05:07 AM
Unfortunately not much. There is an out of the box count Indicator named: Summed re-assignment of open incidents - maybe that will get you started.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2016 07:05 AM
Hello Michael,
Same question I have maybe this time I will be clear on my question.
So, I need to create PA widget for escalated tickets. Escalation between two groups like I would like to define incident tickets which from "X" assignment group escalated to "Y" assignment group.
So how to do that and from where to start?Creating widget, indicator, indicator source,breakdown source or breakdown is no problem. I understand that part very well. Just what to choose for indicator source and for breakdown source conditions by right way. that is only question.
So regarding set up of conditions please let me know. Thanks in advance.
Regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2016 07:25 AM
Example for what I want to get is:
As a support L3 group, I would like to know the list of L2 group which has escalated INC tickets to my group in the previous month.
As a support L2 group, I would like to know the list of L3 group to whom my group transferred tickets in the previous month.
and filter it by: a.time dimension; b.service management (list of groups)
So how can I create this type of widget? Do you have any idea?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2016 05:27 AM
Dear Michael, which Metric can I create and with which conditions to get a data of which tickets changed assignment groups?Still question not resolved for me.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2016 05:52 AM
You can use the business rule / metric as defined in this thread with a condition of current.assignment_group.changes(). Create a new field on the Metric table to capture the original assignment group and then change the script above mi.value = current.assignment_group;
Then whenever the assignment group changes, the BR will run and create a Metric with the previous assignment group and the current assignment group. Then you can report on previous group was x, current group is y.