Skip to content

Commit 5ff6d93

Browse files
authored
Create script.js
1 parent 1106276 commit 5ff6d93

File tree

1 file changed

+16
-0
lines changed
  • Server-Side Components/Scheduled Jobs/trigger on weekday

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(function executeRule(current, previous) {
2+
var today = new GlideDateTime();
3+
var dayOfWeek = today.getDayOfWeek(); // Returns 1 (Monday) to 7 (Sunday)
4+
5+
// Check if it's a weekday (Monday to Friday)
6+
if (dayOfWeek >= 1 && dayOfWeek <= 5) {
7+
8+
var grHoliday = new GlideRecord('cmn_schedule_holiday');
9+
grHoliday.addQuery('date', today.getDate());
10+
grHoliday.query();
11+
if (!grHoliday.hasNext()) {
12+
// Trigger notification
13+
gs.eventQueue('<weekday>', current, '', '');
14+
}
15+
}
16+
})(current, previous);

0 commit comments

Comments
 (0)