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.

Set date field to today's date by default

JJG
Kilo Guru

Hello,

I have a date field on a form that I would like to be set to today's date by default.

I tried to set the default to: javascript:new GlideDate().getDisplayValue(); It doesn't seem to be working, what am I missing?

 

find_real_file.png

 

32 REPLIES 32

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

update it to below

javascript: new GlideDateTime().getDate()

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

That is not working

 

Namrata Khabale
Giga Guru

Hey JJG,

Try this in default value:

 

javascript:gs.nowDateTime();

 

Mark Correct if this solves your issue and also mark  Helpful if you find my response worthy.

 

 

 

Thanks,

Namrata

 

That does not work, remember that the field is not a date/time field, just a date field

 

find_real_file.png