- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 08:33 AM
I currently have a date variable with a default value set for 5 days past the day the request is submitted. However, we would like to set this as 5 business days to not include weekends. Is this possible? Below is the script we are currently using for the default value:
javascript: new GlideDateTime(gs.daysAgo(-5)).getDisplayValue();
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 11:46 AM
//Try this as the default value
javascript: var d5 = '';
var gdt = new GlideDateTime();
var d = 5;
if (gdt.getDayOfWeek() == 6) {
daysout = daysout + 2;
}
if (gdt.getDayOfWeek() == 7) {
d = d + 1;
}
d = d * -1;
d5 = new GlideDateTime(gs.daysAgo(d)).getDisplayValue();
d5;
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2019 11:46 AM
//Try this as the default value
javascript: var d5 = '';
var gdt = new GlideDateTime();
var d = 5;
if (gdt.getDayOfWeek() == 6) {
daysout = daysout + 2;
}
if (gdt.getDayOfWeek() == 7) {
d = d + 1;
}
d = d * -1;
d5 = new GlideDateTime(gs.daysAgo(d)).getDisplayValue();
d5;
Vinod Kumar Kachineni
Community Rising Star 2022