On Hold duration calculation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2025 11:14 AM
I have the scenario, to calculate total duration when incident is put on hold and stop the calculation when incident state is inactive like closed or cancel how to achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
When i create new incident and keept on hold for 5 mins then total on hold time taking like 32 days 18 hours
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @akshaykcc19
- If the record left On Hold and returned later, OOB field accumulates all durations.
The field is calculated by the “On Hold Duration” timer under the Elapsed Time workflow.
It sums all On Hold periods from when the ticket entered On Hold state to the present.
- So a 5-minute On Hold plus a previous 32-day On Hold will show as 32 days 18 hours total.
Thanks,
Vignesh
"If this solution resolves your issue, kindly mark it as correct."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago - last edited a month ago
The Metrics feature can do what is asked. See:
as a starting place.
what you are looking for happens OOB. Look at the metric_instance table for records using the following query: definition=35f2b283c0a808ae000b7132cd0a4f55^value=On Hold
(The sys_id is that of the "Incident State Duration" metric the 'incident' table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hi @akshaykcc19
You can refer following article.
https://www.servicenow.com/community/itsm-forum/calculate-incident-on-hold-duration/m-p/689154
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Thank You!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
- Go to Metric Definitions and create a new metric on the incident table.
- Set the metric to trigger when the incident's state changes to "On Hold".
- Configure a second trigger to capture the time when the state changes from "On Hold" to an active status (e.g., "In Progress").
- This will record the duration of time the incident spends in the "On Hold" state.
- You can use a Business Rule on the incident table that runs when the incident is closed or cancelled.
- Inside the business rule, use the metric definition to sum the total time the incident was in an "On Hold" state.
- Use a function like gs.dateDiff() to get the total elapsed time from when the incident was created to when it was closed.
- Subtract the total "On Hold" duration from the total elapsed duration to get the effective resolution time.
- incident.created_at (Date/Time the incident was created)
- incident.resolved_at (Date/Time the incident was closed or cancelled)
- total_on_hold_duration (A field that sums all the times the incident was in "On Hold" state, calculated using the metric definition)
- effective_duration = gs.dateDiff(incident.created_at, incident.resolved_at) - total_on_hold_duration
If you found my response helpful, could you please mark it as ‘Accept as Solution’ and ‘Helpful’? This small action goes a long way in helping other community members find the right answers more easily and supports the community.
