- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2014 09:51 AM
I've been reviewing the Using DurationCalculator To Calculate a Due Date - ServiceNow Wiki wiki article to figure out how to set the default for a Catalog variable 'Due Date' to three business days from the 'Requested Date' = javascript:gs.now(). I think I need to create a schedule to incorporate in the scripting that is provided in the wiki article but I'm not sure how to design one that defaults to three weekdays from now. I'm still not too comfortable with scripting to but I think that is what I need, does anyone have any advice?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2014 09:46 AM
Sorry Lindsey, not having much luck here!
I've tested this and definitely got it this time...
You just need to add the below as a new line at the top of your script:
javascipt:
So it will look something like:
javascript:
// Get the datetime now
var nowGdt = new GlideDateTime();
...
Fingers crossed!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2014 08:46 AM
Thanks again for your help - in looking at it a little closer I noticed that the date is working perfectly but the time is calculating 6 hours from the current time - so it's doing it 3 business days and 6 hours from now. Is there a way to get it to do 3 business days but the same time?
Here is the schedule I set up:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2015 01:27 PM
(a year and a half later) You will need to account for the user's timezone.
dueDateGdt.getLocalDate();
dueDateGdt.getLocalTime();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2021 03:49 PM
I noticed, using child schedules for holidays do not work, so add the holidays directly to Schedule Entries as below:
var sl = new someScriptInclude_util();
current.due_date=sl.ReturnDueDate(2, current.start_date.toString());
This function will use above schedule, skip holidays, weekends, and calculate your due date.