Script make date 2 weeks ahd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 07:40 AM
Looking into when the user submits the form and selects a due date
that it will auto populate the due date field on the SCTASK form
Script:
task.due_date = current.variables.respond_by;
How to make this script make the date ahead by 2 weeks of the selected date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 10:01 PM
please use the below script, hope this will resolve your issues:
var gdt = new GlideDateTime(current.variables.respond_by);
gdt.addWeeks(2);
task.due_date = gdt.getDate();
Please mark the answer correct/ Helpful, if it resolve your issue.
Thanks !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 10:33 PM
Hello Joshua,
You can use GlideDateTime object to manipulate date.
var selectedDueDate = new GlideDateTime(current.variables.respond_by);
var twoWeeksLater = selectedDueDate.addDays(14);
task.due_date = twoWeeksLater;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2023 10:53 PM
You can use the following script:
var dateAhead= new GlideDateTime(current.variables.respond_by);
dateAhead.addWeeks(2);
task.due_date = dateAhead.getDate();
Please mark this ans correct /helpful if it helps you solve your problem.
