05-26-2021 02:30 AM
Title:
Flow Schedule
Description:
This flow gives you more options of when to run your flow.
You can run it on the last Friday, second week, first business day, certain months, between certain dates, prior to the last week of month, etc... and any other combinations that you can think of.
Detailed Instructions:
Build your flow within this flow at the "condition to run flow" step in the Yes side.
There should be no need to change any of the flow except for the configuration mentioned below in Anything else we should know.
You will need to build conditions at this step and probably expressions to meet your criteria when you want to run your flow.
Of course you will also trigger with schedule instead of manually.
** Most steps also have comments to help understand the flow.
The conditions step is where you control your flow run.
In this step, the flow evaluates today's date and then determines if it is the date your are looking to run the flow in by matching day number, day name, business day, the occurrence of the day, etc...
To start off simple, you can set a condition such as run the flow when businessDays is equal to 5 or what ever.
Most runs will require multiple conditions though in order to run the flow at the correct time.
These are some samples of custom schedule conditions:
Anything else we should know:
The flow is initially set for weeks to start on Sunday and the first week of the month should have at least 2 business days.
You can change this if you want your week to start on Monday, or your choice of day, and you can also change how many business days you want the first week to have.
Because you may not want the month to start on Friday, Saturday and count that as week 1.
This is where you change it:
Notice I have Sunday and 3. The 3 means I want 3 days in my first week of month.
My week starts on Sunday that means it ends on Saturday.
There should be 3 days in my first week before the first Sunday so that it counts as a week.
If you wanted to start on Monday you would set:
Monday, then say you want 3 business days minimum to count the beginning of a month as a week.
Your count would be set to 5.
That's 3 business days and then Saturday and Sunday makes 5, then Monday starts your following week.
Due to your beginning week settings you may end up with 2 Saturdays or Fridays, etc.. in week 1.
In this case you have the dayOccurrence which can check for first Saturday or second Saturday etc...
You also need to be sure in the condition step that you choose from the correct JSON when making conditions.
The correct JSON is the todays date JSON which is an object of today's date and it will not create a apply to each since it is not an array.
The condition would be to use the varBusinessDays.
It holds the total count of business days for the month as well. So subtract 2 in your case and compare to today's date JSON business day.
todays date JSON business day is equal to sub(variables('varBusinessDays'),2)
Schedule the flow to run daily and it will only run past the condition on this business day.
Hi, I have a sharepoint list which caluclates the week number and day from the date. I want my flow to run on 1st business day (Monday-Friday) of every week. Even the 5th week of month (if there is 1). Any advice on how to acheive this?
Hi @Hana0207
The solution to this is simple.
Note: Be sure you are always selecting items from "todays date JSON" dynamic values.
Make a condition to check for the first business day or a Monday. Every first business day after the first week will always be a Monday.
Use the value businessDay and check it equals 1.
Then the value of dayName equal to Monday.
Make sure it is an "OR" condition. Every time it is the first business day or Monday it will trigger.
Your flow will need to run every day though.