We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

please bring due date field on incident form , auto populate with current date and time when form l

srikanthsno
Tera Contributor
 
2 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron

@srikanthsno 

you can configure the form layout and add the Due Date on form.

then you can use onLoad client script to set now date/time in that.

function onLoad() {
    var today_date = new Date();
    var today_date_time_str = formatDate(today_date, g_user_date_time_format);
    g_form.setValue('due_date', today_date_time_str);
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

@srikanthsno 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

3 REPLIES 3

abbasshaik4
Tera Sage

Hello @srikanthsno,

 

Please refer to the link below:
https://www.servicenow.com/community/developer-forum/i-want-to-set-today-s-date-field-automatically-...

 

If it is helpful, please hit the thumbs-up button and accept the correct solution by referring to this solution in the future. It will be helpful to them.

 

Thanks & Regards,

Abbas Shaik

Ankur Bawiskar
Tera Patron

@srikanthsno 

you can configure the form layout and add the Due Date on form.

then you can use onLoad client script to set now date/time in that.

function onLoad() {
    var today_date = new Date();
    var today_date_time_str = formatDate(today_date, g_user_date_time_format);
    g_form.setValue('due_date', today_date_time_str);
}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

@srikanthsno 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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