Notifications

45 views

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

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:39:59
Published:2018-12-19