Workflow timer add businessdays
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2024 03:35 AM
Hi All,
We are using below workflow timer to wait 10 days from start date , now client asking to change 10 Business days , kindly help me code
var change = current.variables.start_date;
var gdt = new GlideDateTime(change);
gdt.addDays(-10);
var assignment = gdt.getDate();
var todaydate = new GlideDateTime();
todaydate = todaydate.getDate();
var dur = new GlideDuration();
dur = GlideDateTime.subtract(todaydate, assignment);
var gdt2 = new GlideDateTime(dur.getValue());
var diff = gdt2.getNumericValue();
diff = diff/1000;
if (diff > 0) {
answer = diff;
} else {
answer = 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2024 01:24 PM
To indicate which days count as business days, you need to set up a schedule. After that, you can use methods of the GlideSchedule API to add time based on your defined schedule. This article by @Mark Stanger contains some examples you can use as a starting point.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/