How to set current date in the Date field?

Anusha Savanth
Tera Expert

Start date is a Date Field. It should populate current date only when the B choice is selected on the A field.

Please help me.

1 ACCEPTED SOLUTION

Anusha Savanth
Tera Expert

Write a ONCHANGE client script 

var currentDate = new Date().toISOString().split('T')[0];
g_form.setValue('start_date',currentDate);

View solution in original post

15 REPLIES 15

Harish KM
Kilo Patron
Kilo Patron

Use this

javascript: new GlideDateTime().getDate();

Regards
Harish

Please help me its not working

share your screenshot where your setting the default value. You need to save the form for this to work

Regards
Harish

Palak Gupta
Tera Guru
Tera Guru

Hi there!

Update the script as below

javascript: new GlideDateTime().getDate()

Please mark my answer correct and helpful if this resolves your issue.
Regards,
Palak