Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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
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  ||  9x 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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Abbas_5
Tera Sage
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
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  ||  9x 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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader