8-5 weekdays excluding holidays- Not excluding weekends properly-OOB Schedule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 03:23 AM
I have a requirement where my lead time for change has 10 business days when risk is high. I have used OOB schedule " 8-5 weekdays excluding holidays" in scripts which used to complete my development. But i faced a issue like when my lead time is 10 business days for my risk high it is not excluding the second weekends which comes under my 10 business lead times calculation.
For eg: If change created today (10/10/2023) and my lead time is 10 business days then it should allow me to enter (10/23/2023) which is date which comes from 10 business days from (10/10/2023) excluding(14,15,21,22-weekends date which are excluded). But unfortunately my schedule is excluding only dates 14,15 and not excluding 21, 21 date for weekend which is not supposed to be.
Since it is not excluding 21, 22 dates it allows user to enter date (10/21/2023 or 10/22/2023) which is not the correct date as part of 10 business days calculation
We used below code in Script Include
var chgStart = startDate || this.getParameter("sysparm_start_date"); //get start date from client side
var chgStartGDT = new GlideDateTime();
chgStartGDT.setDisplayValue(chgStart);
var leadTimeGDT = new GlideDateTime();
leadTimeGDT.addDays(leadTime);
var zoneName = session.getTimeZoneName();
var dur = new DurationCalculator();
dur.setSchedule('090eecae0a0a0b260077e1dfa71da828');
dur.calcScheduleDuration(chgStartGDT, leadTimeGDT);
var secs = dur.getSeconds();
var totalSecs = dur.getTotalSeconds();
we are returing leadTimeGDT
Can you pls help me understand why this issue happens and help me to resolve it. Thanks in advance.