Incident Report should include Incident aging

Priya madyapgol
Tera Contributor

Hi Team, 

 

I have one requirement on Incident Reports,

Incident reports should have Incident age,

for that i have created one custom field on Incident table i.e, Incident age(String field), and have written one Async Business Rule.

calculateAge();
    function calculateAge(){
       
        var datedif = gs.dateDiff(current.sys_created_on.getDisplayValue(),gs.nowDateTime,false);

        current.u_incident_age = datedif;
        current.update();
       
    }
 
but which is not working properly,
when i create new incident records, the custom field is updating as below attached snapshot, but after some time also the time is not changing.
 
Priyamadyapgol_0-1745302750759.png


Please help me to get the solution asap.

Thanks,

1 ACCEPTED SOLUTION

@Priya madyapgol 

if you want age to be seen irrespective of update then use calculated field for that and add the calculation there

so whenever list is opened the field will be calculated and age will be seen

Don't use BR then

AnkurBawiskar_0-1745308576784.png

 

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

View solution in original post

8 REPLIES 8

Sagar Pagar
Tera Patron

Hi @Priya madyapgol,

 

You can take a look at

https://www.servicenow.com/community/developer-forum/aging-reports-on-incident/m-p/1429009

Credit to @Mark Stanger 

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Ankur Bawiskar
Tera Patron
Tera Patron

@Priya madyapgol 

check these links

How can we create Aging Report for Incidents. 

Aging reports on Incident 

Also when is your BR running? after update but what conditions?

If you are updating it on every record update then it will lead to performance issues.

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

Hi @Ankur Bawiskar ,

My BR is 

Priyamadyapgol_0-1745308233579.png


Which is running, age is showing on the record, but only when i update the record at that time only, if i don't update the record age is not updating.
could you please let me know what changes i have to do.

Thanks,

@Priya madyapgol 

if you want age to be seen irrespective of update then use calculated field for that and add the calculation there

so whenever list is opened the field will be calculated and age will be seen

Don't use BR then

AnkurBawiskar_0-1745308576784.png

 

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