Notifications

144 views

Description

Calling the setDateNumericValue method twice with the same value on a GlideElement that supports this method (for example, a GlideDateTime field) will mark that field as unchanged and on calling insert or update the value in the field will not be saved.

Steps to Reproduce

 

1. Open an existing Incident record.
2. Copy the record's sys_id and then click on the Resolution information tab.
3. In a separate tab, run the following code as a background, replacing <sys_id> with the one from the Incident record.

var gr = new GlideRecord("incident");
gr.get("<sys_id>");

var gdt = new GlideDateTime("2018-01-01 12:34:56");
gr.resolved_at.setDateNumericValue(gdt.getNumericValue());
// gr.resolved_at.setDateNumericValue(gdt.getNumericValue());
gr.update();


4. Go back to the open Incident form and confirm that the Resolved at field now contains "2018-01-01 12:34:56".
5. Clear the Resolved at field and save the Incident.
6. Repeat step 3 but uncomment the extra call to setDateNumericValue before running the script.
7. Check the Incident form again. Notice the "Resolved at" field is not populated.

Workaround

After carefully considering the severity and frequency of the issue, and the cost and risk of attempting a fix, it has been decided to not address this issue in any current or near future releases. We do not make these decisions lightly, and we apologize for any inconvenience.

To avoid this issue, either do not update the field with the same value multiple times (put a test in the script making the call), or use the following code as a workaround:

var gdt = new GlideDateTime("2018-01-01 12:34:56");
gr.resolved_at = gdt;
gr.resolved_at = gdt;
gr.update();

 


Related Problem: PRB1270618

Seen In

There is no data to report.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-05-21 11:40:33
Published:2019-01-21