Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Set duration field value

Tapish Sharma1
Kilo Sage

Hi Folks ,

I am adding two durations and then trying to set the duration field value with that ....but the duration is not getting set correctly . I am getting the correct value after adding but while setting it is not correct . It is calculating from 1970 I guess. How can I get the correct duration value and set it ?

 

 

 

 

2 REPLIES 2

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Tapish Sharma1 ,

Please share your script.


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

if(sla.next()){{  //sla is the task_sla gliderecord object

 

var pauseDuration = new GlideDuration(sla.pause_duration.getDisplayValue());
var test = new GlideDuration(duration2);

var ans = pauseDuration.add(test);

sla.setValue('pause_duration',ans);

}