- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2018 03:32 AM
Greetings All,
I'm tasked to capture time the response time between the Incident Create time to first worknotes created on that incident.
I'm thinking of doing this way, but
- Creating a new SLA Definition
- Under 'Start condition'I cannot find either comments/work_notes. So how do I capture this?
Am I thinking wrong? Is there a better approach for this?
Thanks a million!!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2018 11:51 PM
Andy,
I tried it myself and it works for work notes field!!!
Please verify.
Script:
// variables available
// current: GlideRecord - target incident
// definition: GlideRecord - (this row)
var n = current.sys_mod_count;
gs.log("inside this 1");
if (n > 0 && current.work_notes.getJournalEntry(1) != ""){
gs.log("inside this 2");
createMetric();
}
function createMetric() {
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.work_notes.getJournalEntry(1);
gr.duration = gs.dateDiff(gr.start.getDisplayValue(), gr.end.getDisplayValue());
gr.calculation_complete = true;
gr.insert();
}
TEST:
RESULT:
Please Mark it correct and helpful if it was 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2018 04:26 AM
Hi Andy,
I would say, somewhere you are thinking right but you have already found out the issue with it. The SLA definitions will not have an option for comments/worknotes update.
The approach you could go for and I would recommend is using Metric Definitions.
Create a metric definition for the field "Comments and Worknotes". It would be a very simple implementation just to track the time of updating the comments/work notes. There are multiple examples present for "State" field which are simple to understand.
Please mark this Correct and Helpful if it was. 🙂
Regards,
Vidyasagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2018 04:40 AM
Thanks Vidyasagar, I'll give it a shot and let you know how I get along. If there are any other alternatives too, I'm happy to try.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2018 04:49 AM
When I think of this, there could be multiple ways to do this using SLAs as well but it would need
1. adding a new field to incident table(maybe a true/false field) and managing it with a business rule on Incident.
2. Running a new SLA on the new field created above.
Creating a new field on tables like incident/change/problem is never recommended unless it is utmost necessary because these tables usually have a lot of data.
But the end decision would be yours.
Please mark this Correct and Helpful if it was. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2018 07:07 AM
Vidyasagar,
metrics definition will have the same problem which is, the comments/work_notes are journal field they are not on the Incident table, so in the metrics definition the 'Field' column cannot be populated