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.
GlideDateTime.getValue doesn't work correctly when using variable substitution - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • GlideDateTime.getValue doesn't work correctly when using variable substitution
KB0721364

GlideDateTime.getValue doesn't work correctly when using variable substitution


990 Views Last updated : Oct 16, 2023 public Copy Permalink
KB Summary by Now Assist

Description

GlideDateTime.getValue API does not work correctly when using variable substitutions

Steps to Reproduce

1. HOP into demonightlyLondon
2. Go to System - Definition -> Scripts - Background
3. Run the following Script
var gdt = new GlideDateTime();
gs.debug('typeof gdt.getValue(): {0}', typeof gdt.getValue());
gs.debug('Sample message using concatenation: ' + gdt.getValue());
gs.debug('Sample message using substitution: {0}', gdt.getValue());

Expected behavior: The third gs.debug statement should print the value of the variable after substitution.
Actual behavior: The following message is printed out.
*** Script: [DEBUG] Sample message using substitution: org.mozilla.javascript.NativeJavaObject@7629855e

Workaround

The feature is working as expected as per currently supported functionality.

A possible option that could be used is to append the function call with an empty string similar to below example: 

gs.debug('Substitution: {0}', gdt.getValue()+'');


Related Problem: PRB1319836

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.