- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2019 12:52 AM
Hi All,
Is there any OOB field which stores the duration of an incident. I could see 'Duration' field but it calculates once the incident is resolved. I would like to find out age of the incident from incident creation.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2019 01:08 AM
Hi,
There is no direct OOB feature that is available other than the duration field. You shall use duration field which calculates on resolve or use the code that calculates during resolve and store it in your custom field.
Mark the comment as a correct answer and helpful if it answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2019 12:55 AM
You could create a metric that tracks the time from when the ticket was opened to the time now but i'm not sure what the value of this would be.
I think you'd be better off using the standard duration field to report on the duration of incidents once they've been closed and use an SLA to track how long a ticket has been active and report on incidents that breach your SLA conditions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2019 01:03 AM
Hi,
There does not exist any OOB feature to calculate age from creation irrespective of current state. If required an additional field can be created & below snippet (untested) can be used to calculate the age of incident from its creation in the form of Scheduled job.
var datecreated=gr.sys_created_on;
gs.log('Date created is ',datecreated);
var datenowis=gs.nowDateTime();
gs.log('Current date time is ',datenowis);
var gr = new GlideRecord("incident");
gr.addQuery('number','INC0012686'); //try pasing any random incident number for check
gr.query();
while (gr.next()) {
var datediffis= gs.dateDiff(datecreated,gs.datenowis,true);
gs.log('Date diff is ',datediffis)
gr.u_age= datediffis; //Considring u_age is the dictonary value for Age field
gr.update();
}
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2019 01:08 AM
Hi,
There is no direct OOB feature that is available other than the duration field. You shall use duration field which calculates on resolve or use the code that calculates during resolve and store it in your custom field.
Mark the comment as a correct answer and helpful if it answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2024 03:03 PM
step 1: Create a field "incident age" of Duration type
step 2: open the dictionary of the field and apply below code in "calculated value" tab