Incident aging and business hours

giuseppem
Kilo Sage

Hi all

 

It's possible create report for "incidents aging" taking into account working days. 

 

Regards

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@giuseppem 

2 ways

1) you can use a custom field to track the business days and use before update business rules to keep it updating by comparing opened date and now date, use your correct schedule which has business hours etc

// Example: Calculate business days between opened_at and now
var schedule = new GlideSchedule();
schedule.load('08f0b6c0c0a8016400a5fbb684f2d3b7'); // sys_id of your business schedule

var opened = current.opened_at.getGlideObject();
var now = new GlideDateTime();

var businessSeconds = schedule.duration(opened, now); // returns seconds
var businessDays = businessSeconds / (60 * 60 * 8); // 8 working hours per day

current.u_business_age = businessDays; // Set to a custom field

then create a list report on incident table

OR

check this link

Keeping Track: Creating Effective Incident Aging Reports in ServiceNow 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@giuseppem 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

ShazaA
Tera Contributor
 
translator

Hi Kilo Sage,

Yes, it's possible  

 
 
 
Double-click
 
Select to translate