How to add 28 and 30 days to date type variable based on other variable choices in Catalog Item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2024 10:35 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2024 12:47 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2024 01:11 AM
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.