628 views

Description

The 'On-Call Reminders' scheduled job executes the following: fcScriptName=javascript\:new OnCallRemindersNG().sendReminders(null);

OnCallRemindersNG() also has a function, getNumberOfDaysTillNextRotation(), that is used for several purposes:

  • ...check if this is the reminder day for this roster
  • ...find the number of days until the end of the current rotation
  • ...find the number of days until the start of the next rotation

The getNumberOfDaysTillNextRotation() uses a GlideSystem dateDiff() function call to calculate the number of days between the start date of the roster and an end date (if it is not specified, it is the current date).

The issue is the dateDiff() call is using date arguments in the format "yyyy-MM-dd 00:00:00" and if there is a Daylight Savings spring-forward event during the span, the dateDiff() result is calculated as one less than the number of days and 23:00:00, instead of the expected number of days and 00:00:00.

Steps to Reproduce

 

  1. Activate the On-Call Scheduling plugin.
  2. Navigate to <instance>.service-now.com/nav_to.do?uri=cmn_rota_roster.do?sys_id=633a3aeaeb201100fcfb858ad106fe0a and change the rotation start date to 2014-11-10.
  3. As a security admin, navigate to Scripts - Background and run the attached script. It runs for 2015-02-28.

Workaround

The Developer documentation contains an example function in the dateDiff section that shows a workaround. If you change the dateDiff() arguments so the start time is <start date> 12:00:00 and the end time is <end date> 13:00:00, the calculation will always return the correct number of days even if there is a Daylight Savings spring-forward change where an hour is lost.


Related Problem: PRB627015

Seen In

Eureka Patch 4 Hot Fix 1
Helsinki Patch 3
Helsinki Patch 5

Fixed In

Jakarta

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-09-20 15:47:19
Published:2018-09-19