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

Hi @aditya174 , I tried this one also but no luck.

Ankur Bawiskar
Tera Patron
Tera Patron

@jahnavi chanda 

on which form this is required?

why not use default value in that field/variable?

javascript: var gdt = new GlideDateTime(); gdt.addSeconds(7200); gdt;

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

On Customer Case Task form

@jahnavi chanda 

in that case you can use onChange client script + GlideAjax

what's the challenge faced?

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

@Ankur Bawiskar 

If Type = Add User Suspension, then it should auto populate the due date to 2 hours.

This is the challenge