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.

GlideDateTime.getDisplayValue results are different between Flow Designer and Script Background

Kentaro Numata
Tera Guru

Hi, It's Kentaro.

 

I found that GlideDateTime.getDisplayValue gives different results between Flow Designer and Script Background.

Our time zone is Japan.

The script running the attached image is the same.

I need help because I don't know the cause.

 

var gdt = new GlideDateTime();

var local = gdt.getValue();

 

スクリーンショット 2024-06-10 11.25.51.png

1 ACCEPTED SOLUTION

@Kentaro Numata 

so are you having custom action in flow which is returning the time?

what's your business requirement?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

@Kentaro Numata 

getValue() will give GMT time

flow is running with system user?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello, @Ankur Bawiskar.

Thank you fore replying.

 >getValue() will give GMT time

There was a mistake.
The attached photo is the result of getDisplayValue().(Local time is JST)

var gdt = new GlideDateTime();
var local = gdt.getValue();

var gdt = new GlideDateTime();
var local = gdt.getDisplayValue();

 

>flow is running with system user?

Yes, I am running as System User.

スクリーンショット 2024-06-10 15.27.23.png

@Kentaro Numata 

so are you having custom action in flow which is returning the time?

what's your business requirement?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello @Ankur Bawiskar.

 

Yes, you're right.

I would like to create a batch process using Flow Designer that only runs on weekdays.

Flow Designer retrieves incorrect values.

I can get the correct values ​​when I run the same Script in Script Background.

 

Thanks,

Kentaro.