218 views

Description

If you change the date format of your Helsinki instance to dd/MM/yyyy, the Cancel Expired Assessments Job performs incorrect date comparisons, which causes surveys that are not yet due to be cancelled.

In the script, this query:
gr.addQuery("due_date", "<", gs.now());
works correctly only if the date format is the system format: yyyy/MM/dd.

Steps to Reproduce

  1. Navigate to sys_properties and set glide.sys.date_format to dd/MM/yyyy.

  2. Create a new survey instance with a due date a month in the future.

  3. Run the Cancel Expired Assessments job.

    Notice that the survey is canceled.

 

Workaround

To fix the scheduled job:

This prevents this issue happens to future assessment/survey instances, but may still need to fix the corrupted survey instances manually. 

  1. Log in to the instance with Admin access.

  2. Navigate to Schedule Item, sys_trigger, and search for Cancel Expired Assessments.

    To take a backup of the existing record, right-click on Action Menu Export > XML (This record)].

  3. In the Cancel Expired Assessments record, navigate to the Script section and find the following line:
    gr.addQuery("due_date", "<", gs.now());

    Replace it with the following line:
    gr.addQuery("due_date", "<", new GlideDate().getValue());

  4. Save the record and refresh.

  5. Test the script.

    gs.now() gives the display value of today's date but GlideDate.getValue() always gives ISO date format.

 

Fix the corrupted records using either method 1 or 2:

Method 1: run the following script

--------------
var gr = new GlideRecord("asmt_assessment_instance");
gr.addQuery("state","canceled");
gr.addQuery("due_date", ">=", new GlideDate().getValue());
gr.query();
while(gr.next()){ gr.state = "ready"; gr.update(); }
--------------

Method 2: 

  1. Export all the corrupted assessment records into a XML file.
  2. Use Text Editor tools to edit the XML file, replace all the canceled to ready
  3. Import the XML back in

Related Problem: PRB701182

Seen In

Geneva Patch 6 Hot Fix 2
Geneva Patch 7
Helsinki Patch 0 Hot Fix 1
Helsinki Patch 1
Helsinki Patch 2

Fixed In

Helsinki Patch 11
Istanbul

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2017-10-26 04:57:55
Published:2017-10-26