Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

getValue(date) is not working

Manju Shree
Tera Expert

Hi Team,

 

I am trying to get a date value in a variable but unable to fetch the date. Im writing a code on cmn_schedule_span table. I want to get a date field in a variable and display it. While using getValue('mn_schedule_span') or getDisplayValue('mn_schedule_span'), Im only getting null value. Can you please guide how to get the date from the table. Below is my code.

 

var gr = new GlideRecord('cmn_schedule_span');

gr.get("f88b3be6db203200bd27f9231d9619ad");

gr.query();

if (gr.next()) {

    var val = gr.getValue('mn_schedule_span');
    gs.print(val);
    }
 
Thank for the reply in advance
 
Best Regards,
Manjushree
1 REPLY 1

Rohit  Singh
Mega Sage

Hi @Manju Shree ,

 

cmn_schedule_span is actually a formatter and not a filed of a table that's why the script is not fetching the value. I don't think it's value can be fetched.

 

Refer below snip from the form design which show the type of field. Also read about Formatter 

 

RohitSingh_0-1741170450964.png

 

 

If my response helped, please mark it helpful and accept the solution so that it benefits future readers.

 

Regards,
Rohit