Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Calling setDateNumericValue"with the same value twice on a GlideElement that supports it marks the field as unchanged and the element is not updated - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • Calling setDateNumericValue"with the same value twice on a GlideElement that supports it marks the field as unchanged and the element is not updated
KB0693401

Calling setDateNumericValue"with the same value twice on a GlideElement that supports it marks the field as unchanged and the element is not updated


974 Views Last updated : Apr 7, 2024 public Copy Permalink
KB Summary by Now Assist

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

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.