How to add business days to a date field based on category selection (skip weekends)?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello Community,
I need help creating an OnChange client script that adds business days to a date field based on a category selection, while skipping weekends (Saturday and Sunday).
Requirements:
- When category = "Hardware" → Add 5 business days to the date field
- When category = "Software" → Add 10 business days to the date field
- Weekends (Saturday and Sunday) should be excluded from the count
- Date field name: u_date
What I've tried: I've attempted using GlideDateTime() with addDaysLocalTime(), but I'm not sure how to properly implement the weekend-skipping logic and ensure only business days are counted.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Refer below links for the requirement
https://www.servicenow.com/community/developer-articles/add-business-days/ta-p/2324391
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan