Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Background Script that checks today is weekday and then execute further logic inside if block.
This script can also be used in 'Condition' part of Scheduled job, with an answer variable.

var answer = false;
Code snippet{ inside if condition, set answer = true; }
answer;

This will ensure Scheduled Script only executes on Weekdays.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//Code that checks if today is not Saturday or Sunday (i.e. Weekend) and if it turns out that today is not weekend, then execute the further logic written.

var today = new GlideDateTime();
var day = today.getDayOfWeek(); //returns the day of week as number, Monday = 1, Tuesday = 2, ... Saturday = 6, Sunday = 7
if(day != 6 && day != 7){
//Do whatever task or update you want to execute on weekdays be it triggering emails or running scheduled script
gs.print("Today is weekday. Good to execute updates.");
}
Loading