Hi,
I would like to build a scheduled flow for sending a reminder email on the date which is 5 working days before end of each month, i.e. 22/01/2021, 19/02/2021, 24/03/2021... etc. I am new to Power Automate and cannot achieve this recurring setting with built-in recurrence action. Grateful if any ideas or solution can be provided. Thanks a lot.
Solved! Go to Solution.
Hi @dickyocean :
The function of this formula is to judge whether today is the last fifth working day of the month.
Get today's date
formatDateTime(utcNow(),'yyyy-MM-dd')
Get the fifth working day from the end of the month
formatDateTime(
if(
equals(dayOfWeek(addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-1)),5),
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-5),
if(
equals(dayOfWeek(addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-1)),6),
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-6),
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-7)
)
),'yyyy-MM-dd')
The principle is:
This formula is to get the last natural day of the current month.
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-1)
This formula is to get the the first day of the next month.
startOfMonth(addDays(startOfMonth(utcNow()),32))
Best Regards,
Bof
Hi @dickyocean :
Please try this flow:
Set the trigger frequency of the trigger to every day, and then set the conditions for this trigger.
Trigger condition:
@equals(formatDateTime(utcNow(),'yyyy-MM-dd'),
formatDateTime(
if(
equals(dayOfWeek(addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-1)),5),
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-5),
if(
equals(dayOfWeek(addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-1)),6),
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-6),
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-7)
)
),'yyyy-MM-dd'))
Best Regards,
Bof
Hi @v-bofeng-msft ,
Thanks for your reply and idea. I created an experimental flow for trial on 22/1. Meanwhile, may you please explain a little bit about your trigger condition? I try to learn but I cannot read it. Thanks again!
Hi @dickyocean :
The function of this formula is to judge whether today is the last fifth working day of the month.
Get today's date
formatDateTime(utcNow(),'yyyy-MM-dd')
Get the fifth working day from the end of the month
formatDateTime(
if(
equals(dayOfWeek(addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-1)),5),
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-5),
if(
equals(dayOfWeek(addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-1)),6),
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-6),
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-7)
)
),'yyyy-MM-dd')
The principle is:
This formula is to get the last natural day of the current month.
addDays(startOfMonth(addDays(startOfMonth(utcNow()),32)),-1)
This formula is to get the the first day of the next month.
startOfMonth(addDays(startOfMonth(utcNow()),32))
Best Regards,
Bof
Hi @v-bofeng-msft ,
Sorry for late reply and thank you for your explanation! The trial flow works successfully. Thanks a lot!
Best regards,
Dicky
Join digitally, March 2โ4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
User | Count |
---|---|
80 | |
56 | |
55 | |
43 | |
39 |
User | Count |
---|---|
84 | |
81 | |
76 | |
63 | |
42 |