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.

how to set due date 2 hours from current date/time using client script

jahnavi chanda
Tera Contributor

Hi All,

I have a requirement, based on the type selection I need to auto populate due date 2 hours from current date/time using client script How to do it please any one help me.

Thanks in advance!

15 REPLIES 15

raja sekhar4
Tera Contributor

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var gdt = new GlideDateTime();
gdt.addHoursLocalTime(2);
var dueDate = gdt.getDisplayValue();