
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2022 10:43 AM
I have been asked to setup operational task. We are going to use Service Catalog to create requests with the task to do the work. I was going to use flow designer to order the items when they are needed. Daily ones are easy enough as well as weekly. However I have one that they want to fire on the last Tuesday of the month and one that needs to fire on the 1st weekday of the month. How would get these ones to fine?
Solved! Go to Solution.
- Labels:
-
flow designer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2022 02:32 AM
I would create a custom action that instead takes a date/time variable as input.
Then in the script use add days method, and evaluate if the new date is within the same month or not, that way you would know if it's the last thursday, or whatever day, in any given month or not.
This flow could run weekly.
Here's a how I'm thinking;
var inputDate = someDateToCheck;
var checkLastDayOfMonth = inputDate.addDays(7);
if (checkLastDayOfMonth.getMonth() > inputDate.getMonth() )
return true;
else
return false;
The second example when wanting to have the first weekday of the month, is a bit more complex. I can think of two different approaches.
Either you run it daily, and in the script evaluate if it is the first weekday of the month (can also be done with GlideDateTime functions), but it would also require you to evaluate and know if the job already has been run a particular month or not. I'm not sure if the second part is doable, I don't know if you can check this somehow.
The other option is to run the Flow monthly, on the first day of the month, and in a custom script evaluate if its a weekday or not. If it's a weekend, the action should return a number of hours the flow should wait (in an wait action) until continuing the trigger.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 03:08 AM
Hi,
Have you looked at this solution by Mark Roethof?
You should be able to configure it, so that the flow runs daily, and checks if it's the "correct" day of month.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 11:13 AM
I'm not sure this will work for me. They are looking for the 3rd occurrence of a day instead of the last occurrence. The last occurrence could be different for each month.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2022 01:49 AM
That's true, but if you modify the script, you can add a check to see if it is the last occurrence in the month.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2022 12:45 PM
I'm note sure how to modify the script to get he last occurrence.