How to set the outage end date with incident resolved date plus 24 hrs

70 viewsServiceNow

How to set the outage end date with incident resolved date plus 24 hrs

Hi Everyone,

We have a requirement to set the outage end date with the incident resolved date plus 24 hrs.

Can anyone help me in achieving this?

Your help is highly appreciated

Thanks in advance

Unselected an answer
0

Hi,

to add 24hours you need to use addDays(1)

Updated script below

1) since your BR runs when state changes to Resolved; so you can add 1 Day to the current time i.e. 24hours

var outage = new GlideRecord("cmdb_ci_outage");
outage.addQuery('task_number', current.sys_id);
outage.query();
while (outage.next()) {
 var gdt = new GlideDateTime();
 gdt.addDays(1);
outage.end = gdt;
outage.update();
 }

Unselected an answer
0
You are viewing 1 out of 1 answers, click here to view all answers.