
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2020 06:06 AM
Hi all,
I am looking into slowly moving from Scheduled Jobs to Flow Designer. One of the things I can't figure out or might have overlooked... I would expect in Flow Designer just some choice list to appear where you could select a schedule 🙂
How to run a Flow only on workdays?
According to a certain schedule. Is that possible at all with Flow Designer? Or do we need to jump into scripting, Actions, etc. immediately for this... and making using Flow Designer instead of old school Scheduled Jobs actually less worthwhile?
Kind regards,
Mark
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2020 03:59 PM
Hey Mark!
I believe the best bet for this one is a custom action I've created to check if a given time is in schedule.
Create the flow with a "Daily" trigger, running every day at your desired time, then as the first action, check if the time the flow started (a data-dot from the trigger) is within a certain schedule. You could create a new schedule if you don't have one already.
Here's the details of the action:
Inputs:
And the Script Step to check:
Here's the code snippet:
(function execute(inputs, outputs) {
if (inputs.time) {
var timeToUse = new GlideDateTime();
timeToUse.setDisplayValue(inputs.time.toString());
} else {
var timeToUse = new GlideDateTime();
}
var sched = new GlideSchedule(inputs.sched.getUniqueValue());
var output = sched.isInSchedule(timeToUse);
outputs.timeInSched = output;
})(inputs, outputs);
Then map the output to a true/false.
Then your flow will look like this:
Hope that helps!
-Andrew

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2020 05:29 PM
Hey Mark, I've just whipped up an article about this (as I've done the increment days stuff before!)
Check it out:
❤️

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2021 08:57 AM
Hi
This is really cool and is something that I have been trying to get working for my company.
My business problem is as follows. I want to send a SMS out on Incidents that are created after Core business hours.
I created a new schedule (Out of hours 19:00:00 to 07:00:00) which looks like the following,
I have then followed your notes above by creating the Action
In my flow I am now doing the following
The Input time I have based this on the Created Date / Time of the INC and not the Run Start time of the Trigger. I tried this but still get the same results.
The issue that I am having is that every priority 1 INC that I am creating is going down the TRUE path regardless of the time. Example I created a P1 INC before 19:00:00 this should evaluate to FALSE but it's not.
been stuck on this today and would appreciate some thoughts
Kind Regards
Mark