How to add 28 and 30 days to date type variable based on other variable choices in Catalog Item

AkhilT
Kilo Contributor

Hi All,

We have a catalog item, it has two variables. One is date type variable and second one is choice type variable. We need to populate the date type variable with

1. 28 days from today date when choice value is critical from second variable.

2. 30 days from today date when choice value is high from second variable.

How can we implement this functionality using catalog client script. Thank you in advance.

 

2 REPLIES 2

SnowReece
Tera Expert

You'll need to write a GlideAjax script that calls a script include that uses GlideDateTime to add 28 or 30 days to the current date.

 

What have you tried so far?

Anubhav24
Mega Sage
Mega Sage

Hi @AkhilT ,

 

You can try as the sample code below :

var gdt = new GlideDateTime("<Put your date here> 00:00:00");
gdt.addDays(<Put number of days here>);
gs.print(gdt.getDate());

 

However you need to write GlideAjax to send the dates to a script include and then do the above operation and then return the dates.

Please mark helpful/correct if my response helped you.