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.
Date Variable values change when saving a record that includes the Variable Editor, if .disabled=true has been set for the variable element using DOM manipulation - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • Date Variable values change when saving a record that includes the Variable Editor, if .disabled=true has been set for the variable element using DOM manipulation
KB0635652

Date Variable values change when saving a record that includes the Variable Editor, if .disabled=true has been set for the variable element using DOM manipulation


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

Description

If all variables are made read-only in the Variable Editor on record forms using a DOM manipulation client script taking this form, then Data type variables will get updated by a number of hours. Due to the session timezone not being taken into account on the update once the variable has been disabled in this way, the date value will be updated with +/- the user's session timezone offset.

var ve = $('variable_map').up('table');
//Disable all elements within with a class of 'cat_item_option'
ve.select('.cat_item_option', '.slushselectmtm', '.questionsetreference').each(function(elmt){
elmt.disabled = true;
});

Steps to Reproduce

  1. Create a Client Script, onLoad, for table Requested Item [sc_req_item], containing the following script:

    var ve = $('variable_map').up('table');
    //Disable all elements within with a class of 'cat_item_option'
    ve.select('.cat_item_option', '.slushselectmtm', '.questionsetreference').each(function(elmt){
    elmt.disabled = true;
    });
  2. Log in as a catalog_admin role user, or anyone able to update a RITM.

  3. Set the user's profile to a timezone several hours away from GMT.

  4. Open any existing Requested Item RITM record that has Date type variables in default view so that the Variable Editor is displayed, and update the comments of the record.

    Note that the date variable's value has changed by the same number of hours as the user's offset from UTC.

 

 

Workaround

There is no workaround for this behavior as DOM manipulation is not supported within the ServiceNow platform. Unless the g_form API is used for making variables hide or read-only, this type of scripting will break the application.

If this is done with unsupported direct DOM manipulation rather than the supported g_form API, our code is not aware it has been done, which negatively affects the update of the record. The side effect is that on systems that have a custom date format set or the system timezone is not GMT, date variables can be corrupted or the dates changed by several hours equal to the GMT offset.

For more information, see the product documentation topics Unsupported client scripts and Client scripts good practices: Avoid DOM manipulation.

 

 


Related Problem: PRB924640

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.