- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2018 04:46 PM
Team - I have a metric set up in our change table to record the time between the end date of the change and when it is closed. Creating the metric has improved our Change Manager's ability to manage compliance, however they have identified that time over a weekend should not be included - ie if a change finishes at 1PM on Friday and is closed at 1 PM on the following Monday it should capture 1 day (24 hours)
Is anybody able to assist - below is the current code working as initially requested:
Cheers
createMetric();
createMetric();
var mi = new MetricInstance(definition, current);
if (mi.metricExists())
return;
gr.start = current.work_end;
gr.end = current.closed_at;
gr.duration = gs.dateDiff(gr.start, gr.end);
gr.calculation_complete = true;
gr.insert();
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2018 04:52 PM
Use case 2.1 should help you in below blog
https://community.servicenow.com/community?id=community_blog&sys_id=467c62e1dbd0dbc01dcaf3231f9619ad
You can use a schedule and set your work end time.
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2018 04:52 PM
Use case 2.1 should help you in below blog
https://community.servicenow.com/community?id=community_blog&sys_id=467c62e1dbd0dbc01dcaf3231f9619ad
You can use a schedule and set your work end time.
Please mark this response as correct or helpful if it assisted you with your question.