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

@Anusha M 

why to use client script when it can be done by server side without any script using default value?

Regards
Ankur

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

 After `Set the Current date value to field , I want able to update  date .