Set Default value to 3 days from now

Henrik Jutterst
Tera Guru

On a Catalog Item, in a new date variable - is there a way to set Default Value to current date and add (for example) 3 days from now?

find_real_file.png

Above example sets current date. But how can I add 3 more days in the default value?

 

My goal is to add days dynamic based on Delivery time (delivery_time) in the default value.

 find_real_file.png

 

Lite this in portal:

find_real_file.png

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

You can mention under default value

javascript:var gdt=new GlideDateTime();gdt.addDays(3);gdt.getDate();

View solution in original post

6 REPLIES 6

asifnoor
Kilo Patron

You can mention under default value

javascript:var gdt=new GlideDateTime();gdt.addDays(3);gdt.getDate();

It works!

Now to the million dollar question.. Is it possible to use the value from delivery_time instead of the hard coded "3"..

We cannot use the default value in that case.

you have to use onChange client script on duration field and there you can do the add the date.

Check this article on how to set the date in the client script.

https://community.servicenow.com/community?id=community_article&sys_id=a26dac761b4e8010a59033f2cd4bc...

Thank you Asif for your answer and also to the article you linked to. That will help me alot i think. Just the kind of answer I was hoping to get here.

Have a good day!