- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 04:23 PM
Hey everyone,
I'm a novice with ServiceNow (currently Jakarta), and our organization doesn't have a developer, so if I want something, I have to learn it myself. I'm normally fine with that, but I'm stuck on a recent project.
I need to report on the # of Work Notes updates made, grouped by user. By my research, I'll need to script a Metrics Definition to collect this information. I'm trying to do this, but I'm not having any luck.
For some context, I want to report on Work Notes updates by user because I have a team of student workers who can't take ownership for Incidents per ITIL's normal methodology. If I have a number of Work Notes updates per Student Tech, I can use that to gauge how many tickets/week are being worked on.
Here's what I have so far:
// variables available
// current: GlideRecord - target incident
//definition: GlideRecord - (thisrow)
if (current.work_notes.changes())
createMetric();
function createMetric(value) {
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
var gr = mi.getNewRecord();
gr.start = current.sys_created_on;
gr.end = current.sys_updated_on;
gr.value = current.sys_updated_by.getDisplayValue();
gr.insert();
}
Any suggestions? Thank you!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 06:52 PM
You can't use .changes() in a metric script. It only accept current, period. You can throw that script into a business rule.
Review this thread on how to do that: https://community.servicenow.com/message/899065#899065

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 06:52 PM
You can't use .changes() in a metric script. It only accept current, period. You can throw that script into a business rule.
Review this thread on how to do that: https://community.servicenow.com/message/899065#899065
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 09:37 AM
Thank you Michael! I followed the instructions in that thread and am now able to report on changes in the Incidents table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 09:39 AM
Great!