cancel
Showing results for
Did you mean:

## Setting recurrence to day of month

I'd like to set a trigger for tasks for the 1st and 3rd Wednesdays of each month.

I have been able to specify the logic:

1. Test to see whether today is a Wednesday
2. Test to see whether today's date is between 1 & 7, or 15 & 21

And after a bit of searching (the documentation for Flows is terrible!) I think I have come up with the advanced condition:

```@and(
equals( dayOfWeek(utcnow()),4 ),
and(
greaterOrEquals( dayOfMonth(utcnow()),1 ),
lessOrEquals( dayOfMonth(utcnow()),7 )
)
)```

I have asked the Flow to reoccur every 1 day in my timezone (Sydney GMT+10) at 9 AM. I'll post an update to say if it works tomorrow!

7 REPLIES 7

My schedule didn't run. I think it was because of the "Start time" I chose for the recurrence. It was yesterday's date. I put it in the ISO 8601 format (2017-05-01T09:00:00Z) which I suppose was strictly in the past. Or maybe as another thread states, I have to use the format "Mon, 01 May 2017 09:00:00". It really is difficult to just say "the Flow should begin at 9 AM in the timezone specified!"

Also I have updated the logic, but I've just realised it's not perfect:

```@and(	equals(		dayOfWeek(			utcnow()		),3	),	or(
and(
greaterOrEquals(
dayOfMonth(
utcnow()
),1
),
lessOrEquals(
dayOfMonth(
utcnow()
),7
)
),		and(
greaterOrEquals(
dayOfMonth(
utcnow()
),15
),
lessOrEquals(
dayOfMonth(
utcnow()
),21
)
)	))```

(Wednesday = 3, actually I'm sure I read yesterday that Sunday = 1 but manually testing has shown that Monday = 1)

The logic above can only tell me if the current day is the 1st/3rd of the month. What I really want to know is if the current week contains a Wednesday which is the 1st/3rd of the month (then reminder messages can be sent in advance on Monday/Tuesday).

Someone with more experience of WDL might be able to come up with a test for that!?

My Flow ran today. I discovered, as did someone else on these boards, that the time zone is ignored in the Recurrence trigger, if you put a time in. I used 2017-05-01T00:00:00Z which worked, posting at 10:00 here. It will be fine for now but it isn't going to adjust for daylight saving (summer time).

I have thought more about how to send reminder messages ahead of time (in this example it is a Monday before a 1st/3rd Wednesday):

```@and(
equals(
dayOfWeek(
utcnow()
,2)
),3
),
or(
and(
greaterOrEquals(
dayOfMonth(
utcnow()
,2)
),1
),
lessOrEquals(
dayOfMonth(
utcnow()
,2)
),7
)
),
and(
greaterOrEquals(
dayOfMonth(
utcnow()
,2)
),15
),
lessOrEquals(
dayOfMonth(
utcnow()
,2)
),21
)
)
)
)```
Frequent Visitor

Yep Lloyd, you ran into the exact same thing I did.  The only MSFT guy reading these boards ignored my follow up to him because I believe the format restriction is actually erroronous and was accidentally introduced recently (originally your format would have worked a while back allowing you to put the local time/date for when to start).

The one thing that is annoying with all of this, because of such primitive scheduling, this does count as 30 flow runs a month againt your quota of flow runs (not an issue if you are on an E plan/dynamics).  Imagine wanting to have a flow check for an event 4 times a day on week days.  You are stuck either making a single workflow and having a ton of runs extra hit against your quota, or you make a bunch of workflows (one for each period each day).

Also just wanted to say, I appreciate the idea of doing a conditional check on the flow so I can reuse and just have 4-5 flows to check during the day. Initially I wanted to be really cheap and I was going to make a separate flow for each day/time combo during the week! 🙂

Thanks for the reply @gosubtle, I hadn't considered the impact of running these every day. I have now set the recurrence interval to 7 days, which is only wasting about 55% of the runs. I can't actually even see the area on the website which shows how many I've used out of my quota.

Definitely more complex scheduling would be appreciated!

Also what would be good would being able to branch logic off the schedule. For example, in my case, it would be good to do one action if today is Monday, and a different action if today is Wednesday, etc.

Well, I set up one of my Flows scheduled to start on the 15th of May, with an interval of 7 days. It ran today... no idea why!

Frequent Visitor

Did it run 7 days ago by chance?  Or have already run once?  That really makes no sense either way unless it looked at a previous run and then calculated off that time and ran it and just ignored the "start time".

Also, just as an FYI @Lloyd, if you can figure out a way to call a flow from the scheduler in Azure, sadly they have some much nicer options in them for when to start and kick off etc.  This includes where you can select times and which days of the week you want it to run.  Only thing is, you can only have 1-2 scheduled jobs before you have to buy the paid version which isn't super cheap.  My guess is, you could probably set them up to send an email much easier without even using flow though if you have the development know how.

Finally, I fought through enough stuff, and man this stuff shouldn't be public preview.  It is missing very important things such as connections permissions (they don't even consider the use of sql accounts and stored procedures for security) nor do they consider named connections where you can actually specify the name of the connection so you know what it is especially between powerapps and flow.  Variables anyone?  In addition, as far as I could tell, you can't share things such as connections so that an admin could set it up and set permissions so that people can just create flows from it (maybe i'm wrong on this but i didn't see anywhere).  I did get my flow working, it emails me whenever any new customers submit their contact information to my azure contact web app/SQL db every 2 hours during week days.  Just really wanted to thank you for giving me the idea to apply a condition based on current time as I don't want emails at 9PM on Saturday nor do do i want to miss an important client! 🙂

Nope, it didn't exist 7 days ago. It had run a few times but not when that condition was set. Really odd! I don't have a lot of confidence that it will run when I actually want it to.

You're welcome to have the inspiration! I agree, a lot of aspects of this product are wanting. Most of the useful things require the advanced conditions, but I don't know of a way to test the "workflow definition logic" so it seems pot luck if you get it right.

I think Flows is actually built upon Azure Logic Apps. While the wonderful world of Azure seems to offer many possibilities, it seems quite hard to get into and I don't want to put the time in (but thanks for the heads up regarding better scheduling). Flows should be an easy and fast way to get things done.

Announcements

#### Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

#### Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

#### Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

#### What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,330)