Set default date for Date field in a Catalog

Abhi369
Tera Contributor

I have a Date variable in a ServiceNow Catalog.

The Date field is at question number 7 and I want to set it's value based on question 1.

I want to set its value to 4 weeks ahead from the current date based on some condition which are selected in the previous question i.e. Q1.

 

I was thinking of using OnChange Catalog Client Script and GlideAjax() on "

ClientDateTimeUtils" but couldn't reach to the solution.

 

Please help me in finding the solution.

 

Thank you!

6 REPLIES 6

Samaksh Wani
Giga Sage
Giga Sage

Hello Abhi,

 

// store the above date in variable called date;

var numWeeks =4;
date.setDate(date.getDate() + numWeeks * 7);

 

Plz Mark my solution as Accept, if you find it helpful.

 

Regards,
Samaksh

Hi Samaksh,

 

Sorry, that didn't work.

 

Can you share the Screenshot ??

Sorry, I cannot share the Screenshot. But for the clarification I can say that I have a Date field in a Catalog item. I want to set it's default value to 28 days from the current date in future.