
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 05:08 AM
I created a scheduled job to create a request that I only want to generate on Monday thru Friday.
Below is the script I put into the advanced tab on the scheduled job record:
function checkCondition() {
var gdt = new GlideDateTime();
var dayOfWeek = gdt.getDayOfWeekLocalTime();
// Monday is 1, Sunday is 7
if (dayOfWeek >= 1 && dayOfWeek <= 5) {
return true; // Run the job
} else {
return false; // Don't run the job
}
}
However, it is run every day, including Saturday and Sunday.
Have I missed a step?
The job is scheduled to run Daily on the US/Eastern time zone schedule
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 05:09 AM
Did you select the option to have the Flow variable as a boolean True/False ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 04:17 AM
Found out there were 2 scheduled jobs, so I made the 2nd one inactive! Testing that now and if that was the problem, then the script worked.
If that doesn't solve it, then I will do the Flow step instead.
Thank you very much!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 04:44 AM
I quick question on the Flow part:
I was able to create the flow variable, but when I go to the If part, even though I select it, I don't get the option of "is" to select "false"
Options are:
Picked wrong one??
Put in the script on the flow variables:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 05:09 AM
Did you select the option to have the Flow variable as a boolean True/False ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 05:15 AM
Nope that is what I did wrong!
Thanks - flow is set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2025 05:53 AM
In a Scheduled Job, I’ve written a sample script to test weekday-based conditions. The logic works correctly for Monday, Thursday, and Friday when answer = true. However, the time zone is not functioning as expected. I’ve tried debugging it, but the issue still persists. Kindly check the behavior in your respective time zone as well.