- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 08:06 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2024 11:17 PM
Hi @JPSS yes the function as written should convert today's date to workday (of current month)
Give it a try in Background scripts
--
Bala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2024 04:54 AM
Hi @JPSS
OOTB not available and to do this, need to read the calendar and then calculate.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2024 08:55 PM
Can you please help me with the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2024 11:02 AM
Hi @JPSS here is javascript function that can do that.
(function numberOfWorkdays() {
var gdt = new GlideDateTime();
var oneday = 24 * 60 * 60 * 1000;
// get current month
var cmon = gdt.getMonthLocalTime();
var mon = cmon;
var wdays = 0;
while ( mon === cmon ) {
var dofw = gdt.getDayOfWeekLocalTime();
if( dofw >= 1 && dofw <= 5) wdays++;
gdt.subtract(oneday);
mon = gdt.getMonthLocalTime();
}
return wdays;
}())
If this answer solved your issue please mark it ✅ as a solution or mark it 👍 helpful if it was of help.
--
Bala Guthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2024 08:55 PM
Hi Bala,
the date would varies. the function should convert todays date to workday