File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Server-Side Components/Scheduled Jobs/trigger on weekday Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ Purpose: To send notifications only on business days (Monday to Friday).
2+
3+ Verifies if the current day is a weekday (Monday to Friday).
4+
5+ Action on Valid Business Day:
6+
7+ Triggers a custom event:
8+
9+ Use Case:
10+
11+ Ideal for daily reminders, alerts, or updates that should not be sent on weekends
Original file line number Diff line number Diff line change 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);
You can’t perform that action at this time.
0 commit comments