We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Issue with gs.calDateDiff function

agarwm
Kilo Contributor

Hi,

There is an out of box Business Rule on Incident Table named "mark_closed", which used gs.calDateDiff function to calculate difference between 'opened_at' and 'closed_at' fields.
However, this function is not working properly. There seem to be some issue. We have several incidents opened for which it is returning a value of '0'.
eg:
Opened : 2012-05-21 12:21:02
Closed : 2012-05-21 16:19:48
Duration : 00:00:00

This function is documented here:
http://wiki.servicenow.com/index.php?title=GlideSystem_Date_and_Time_Functions#calDateDiff.28String.2C_String.2C_boolean.29

I am unable to find out whats wrong with it. Can someone please help me in letting me know what am I missing here?

Thanks,
Mayank

7 REPLIES 7

Hi Mayank,


I am also facing the same issue now. Have you got any solution for the issue?




Thanks


Jayaraj Antony


Well, as it was said here - go to sys_calendar table and fix the smans in the only OOB calendar there.:)


CapaJ
ServiceNow Employee

Bah 😞 Prob'ly best to use a Schedule, then:
http://wiki.servicenow.com/index.php?title=Calculate_Duration_Given_a_Schedule