The CreatorCon Call for Content is officially open! Get started here.

How to populate current date and time in field?

RAM75
Tera Contributor

How to populate current date and time in field?

Note: that field should be in read only mode.

Thanks

1 ACCEPTED SOLUTION

Hi,

Remember -> new GlideDateTime() will work in both global and custom scope application

find_real_file.png

Regards
Ankur

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

View solution in original post

3 REPLIES 3

Pranav Bhagat
Kilo Sage

Set the default value of the field with the 

 

In Default value use javascript:gs.nowDateTime();

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use default value in the field

javascript: new GlideDateTime();

Then make it read-only at dictionary level itself if it is always read-only

Regards
Ankur

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

Hi,

Remember -> new GlideDateTime() will work in both global and custom scope application

find_real_file.png

Regards
Ankur

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