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.

Negative Values in glide_duration field

CChinnakannappa
Kilo Explorer

Hi, I have 3 glide_duration fields, the difference of the first two glide duration_fields should be displayed in the 3rd glide_duration field. I have written the the following business rule -

var curr = current.work_effort.getGlideObject().getNumericValue();;
var curr1 = current.effort.getGlideObject().getNumericValue();;
var dif = parseInt(curr1) - parseInt(curr);
current.u_effort_difference.setDateNumericValue(dif);

it is working when "effort" is greater than "work_effort". but my requirement is
if(effort > work_effort)
it need to display the positive difference say 3 days 2 hours (it is working fine with the above code).
and if(effort
it need to display negative difference say -(Minus)3days, 2 hours (this part is not working).
Some one please help me ASAP.
Thanks.

1 REPLY 1

CapaJC
ServiceNow Employee
ServiceNow Employee

I believe a duration field cannot display a negative value. You'd need to use a decimal field or something like that, or come up some other visual display indicator to reflect that it should be considered negative.