Skip 15 business days from now to select a new date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2025 09:44 AM
Hi,
I have a scenario where I should not allowed to select 15 business days from today. I found the code from the documentation, I updated it a little and it looks like I am getting the output as 2 months. Kindly help.
var startDate = new GlideDateTime();
gs.addInfoMessage(startDate);
var days = 15;
var dur = new GlideDuration(60 * 60 * 24 * 1000 * days);
var schedule = new GlideSchedule('090eecae0a0a0b260077e1dfa71da828');
var end = schedule.add(startDate, dur);
gs.addInfoMessage(end);
output:
Background message, type:info, message: 2025-01-13 17:43:33
Background message, type:info, message: 2025-03-12 16:43:33
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2025 08:36 PM
Hi @Dave_p ,
Its showing the end date based on applied schedule with duration.
the end date calculation is excluding the non-business hours as per applied schedule.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2025 10:12 PM
I already shared solution here in your later question.
Please close this thread
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 05:33 AM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader