- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 06:26 AM
Hi,
I am in a scenario where I should i be allowed to select next 15 business days from today. I tried getting some help from community, but it didn't work. Kindly help.
(function executeRule(current, previous /*null when async*/ ) {
var schId = "090eecae0a0a0b260077e1dfa71da828";
var sch = new GlideSchedule(schId);
var now = new GlideDateTime();
var next15Days = sch.add(now, 15, "business");
var dateThreshold = new GlideDateTime(next15Days).getDate();
if (current.desired_completion_date < dateThreshold) {
gs.addErrorMessage("Date must be after 15 business days.");
current.setAbortAction(true);
}
})(current, previous);
Regards
Suman P.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 06:30 AM
you should use onChange catalog client script rather than BR
check this and enhance
Variable Date no less than 5 business days
Auto-populating and validating date fields
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
03-21-2025 07:16 AM
Hi Dave - 43200 is how many seconds are in 12 hours(the schedule of 8-8 is 12 hour business days).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 07:11 AM
Hi @booher04,
I understood the code perfect but one small thing. What is 1000 please?
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 07:12 AM
Thank you for marking my response as helpful.
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
01-15-2025 07:13 AM
1 second is 1000 milli second
So it's converted to be used in GlideDuration
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
03-21-2025 06:49 AM
Hi @Ankur Bawiskar,
I have short term memory. Can you please help how did @booher04 get 43200.
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 07:06 AM