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

Hey JJG,

 

Try:

javascript:new GlideDate();

 

 

Result:

Its working.

 

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

 

 

 

Thanks,

Namrata

 

Hey JJG,

The gs.nowDateTime() method is not available in scoped applications.

 

 

Try in this way for Scoped application.

find_real_file.png

 

RESULT:

 

find_real_file.pngIt works AS per your requirement for Scoped applications.

 

 

 

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

 

 

Thanks,

Namrata

 

 

 

 

 

 

Apeksha Joshi
Kilo Guru

Hi,

javascript:new GlideDateTime.getDate();

 mark my answer correct helpful based on impact 

regards,

apeksha

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

 

find_real_file.png

try :

javascript:new GlideDateTime.getDate();