Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

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

16 REPLIES 16

not working

try this 

javascript: new GlideDateTime().getDate();

no it is also not working

can you share screenshot?

 

kartiksethi
Tera Guru

Hi @Anusha M 

 

Try the below-provided line in the default value:

javascript: gs.now()

Or if time is also required

javascript: gs.nowDateTime()

 

This should work!!


Please mark my answer as correct if this solves your issues!

If it helped you in any way then please mark helpful!

 

Thanks and regards,

Kartik