Notifications

260 views

Symptoms


 

Seeing a Timestamp issue in the CAB Workbench

It shows one hour difference for few timezones as a result of daylight savings.

 

Cause


 

This only happens to the users who are using a timezone that has daylight savings.

However, this should function correctly for all other timezones.

This is expected behaviour for GlideTime to be daylight savings unaware.

The Script Include responsible for adding notes in CAB modules is the "CABRuntimeStateSNC" Script Include.

Currently in London Patch 6a the code responsible for this is on line 72 of this Script Include.

The last 2 parameters on this line are 'dt.getDisplayValue()' and 'session.getTimeZoneName()'. It is the 'dt.getDisplayValue()' which is causing the issue.

This is because 'dt' is a reference to the GlideTime object which does not support or look out for daylight savings.

You can test this by running a simple background script to see that daylight savings are not account for:

  • Change the User to a timezone other than System or GMT
  • Go to "System Definition > Scripts - Background"
  • Copy and paste these lines:
          var dt = new GlideTime();
gs.info(dt.getDisplayValue());
  • Run the script
  • See that the incorrect time is returned. It is 1 hour off.



Resolution


 

The "CABRuntimeStateSNC" Script Include is read-only and therefore cannot be modified.

This means you will need to copy the updateAgendaDecisions() function from the "CABRuntimeStateSNC" Script Include.

The updateAgendaDecisions() function is on line 61 - 76 as of London Patch 6a. However, this could change in future versions.

You can then paste this into the "CABRuntimeState" Script Include which is not read-only and can be modified.

It should be pasted after the initialize() function (on line 9 as of London Patch 6a)

(Please remember this will count as a customisation and you should look out for future Skipped Upgrades)

Now the CAB Workbench will use the updateAgendaDecisions() function in the "CABRuntimeState" Script Include instead of the SNC read-only version

In the "CABRuntimeState" Script Include once you have pasted the function you can now make the modifications which are as follows:

First, you need to replace the following line:

var dt = new GlideTime();

This should be replaced with:

var dt = new GlideDateTime();

Next - As mentioned above, you will need to modify the second to last parameter ( dt.getDisplayValue() ) of the following line:

var str = gs.getMessage("(CAB Automation) - {0} - {1} - {2} - {3} - {4}", [agr.task.getDisplayValue(), decision, gs.getUserDisplayName(), dt.getDisplayValue(), session.getTimeZoneName()]);

And should instead be replaced with this:

var str = gs.getMessage("(CAB Automation) - {0} - {1} - {2} - {3} - {4}", [agr.task.getDisplayValue(), decision, gs.getUserDisplayName(), dt.getLocalTime().getByFormat(""), session.getTimeZoneName()]);

The CAB Workbench Meeting Notes should now account for Daylight Savings and the time should display correctly.

Article Information

Last Updated:2019-05-23 07:50:03
Published:2019-05-23