Metric Definition Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 09:11 AM - edited 03-12-2025 07:16 AM
Hi All,
How to calculate the time taken from open to resolved state excluding onhold on incident table.
Thanks in advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 10:16 AM
I'd recommend reviewing the below YT Video. In short, an existing metric definition (Incident State Duration) is capturing this information. You just need to create an indicator source, and script to sum the data
https://www.youtube.com/watch?v=g4Ee73HQU7w
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 11:49 AM
Hello @MarripudiL
First Run GlideAggregate on incident_metric table with value as "on hold" for the incidents. GlideAggregate as SUM.
You need to store this value in GlideDuration type field and convert it to milliseconds.
Next, find the milliseconds difference between gs.dateDiff(sys_created_on, resolved time)
Then subtract the OnHold milliseconds value from this.
I have already implemented this in my customer instance and storing the percentage in a custom field. So please follow this way, it should work.
Kindly mark my answer as helpful and accept solution if it helped you in anyway,
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY