web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : 6jqdFNuoBPE8+nkB8cK/cH
Power Automate - General Discussion
Answered

Birthday reminder with reminder sent earlier if holiday or weekend

Like (0) ShareShare
ReportReport
Posted on 23 Jun 2023 06:51:49 by 53

I want to have a birthday/anniversary reminder that sends on workdays. Birthdays are stored on a MS List. Screenshot 2023-06-23 at 2.28.16 PM.png.

First logic group checks that it falls on a weekday. 2nd group check for those that fall on Sat and last group check for those that fall on Sunday.

I have solved the issue whereby reminder is sent on Friday if it falls on Sat or Sun. As seen in cover photo.

 

However, if it falls on a holiday, what logic should I use? TIA.

I have the same question (0)
  • ScottShearer Profile Picture
    25,240 Most Valuable Professional on 23 Jun 2023 at 07:49:21
    Re: Birthday reminder with reminder sent earlier if holiday or weekend

    @mclim 

    I suggest adding all holidays for the next few years to a SharePoint list.\

    Add a final check before the email is sent that compares the that you'll be sending the email to the holiday list.  If the date is in the holiday list, take action as appropriate.  If the date is on a weekend, just send the email.  Otherwise add some logic based on the day of the week.

     

  • mclim Profile Picture
    53 on 23 Jun 2023 at 12:03:10
    Re: Birthday reminder with reminder sent earlier if holiday or weekend

    @ScottShearer , I think I was not clear the first time. If the birthday is on a weekend, send it on the Fri just before. Hope that clarifies. I am stuck on the logic needed to make it work.

  • abowen Profile Picture
    222 on 23 Jun 2023 at 13:39:51
    Re: Birthday reminder with reminder sent earlier if holiday or weekend

    In your OP you say you have solved the weekend issue and are asking for assistance on the holiday issue, yes? I believe Scott has answered your question. Just use the same logic excluding weekends but exclude holidays instead (after implementing Scott's solution, holidays in SharePoint list). 

  • mclim Profile Picture
    53 on 25 Jun 2023 at 06:01:31
    Re: Birthday reminder with reminder sent earlier if holiday or weekend
    My algorithm -
    If utcNow() is birthday, and it's not Sat,Sun, send greeting.
    If utcNow() + 1 is birthday, and its Fri, send greeting
    If utcNow() + 2 is birthday, and its Fri, send greeting.
     
    @abowen , but this algorithm cannot be applied for holiday as holiday can be two days in a row and holidays can fall on weekend too. It works for weekend though.
     
    Let me know what is the algorithm you have in mind? Thanks.
  • ScottShearer Profile Picture
    25,240 Most Valuable Professional on 25 Jun 2023 at 08:50:36
    Re: Birthday reminder with reminder sent earlier if holiday or weekend

    @abowen 

    AFTER you have applied your algorithm and before the email is sent:

    • Lookup the date the that the email is to be sent in a SharePoint list that contains all holidays
    • If the date the email is to be sent is on a holiday, add additional logic to handle it
      • Example: if the holiday is on Tuesday - Friday, send the email the previous day
      • Example: If the holiday is on a Monday, send the email the previous Friday.

    Hope this helps...

     

     

  • Verified answer
    Chriddle Profile Picture
    8,319 Super User 2025 Season 2 on 26 Jun 2023 at 07:14:59
    Re: Birthday reminder with reminder sent earlier if holiday or weekend

    I created a flow using the simplest algorithm I can think of:
    Given a date, subtract a day until it is Mon-Fri and is not in the holiday array.

     

    Chriddle_0-1687763359774.png

     

    Initialize variable reminderDate

    addDays(outputs('Date'), 1)

     

    Do Until

    @And(
    	contains(createArray(1, 2, 3, 4, 5), dayOfWeek(variables('reminderDate'))),
    	not(contains(outputs('Holidays'), variables('reminderDate')))
    )

     

    NewDate

    addDays(variables('reminderDate'),-1,'yyyy-MM-dd')

     

    Set variable reminderDate

    outputs('NewDate')

     

  • mclim Profile Picture
    53 on 28 Jun 2023 at 08:08:02
    Re: Birthday reminder with reminder sent earlier if holiday or weekend

    @Chriddle , I will test out your algorithm against 2 consecutive days of holiday. I reviewed your algorithm a few times but still couldn't figure out whether it would work or not...algorithms is not my strongest point.

     

    I am a newbie to powerautomate. May I know what function you used for "Date" and "Holidays"? Thanks.

  • Chriddle Profile Picture
    8,319 Super User 2025 Season 2 on 28 Jun 2023 at 08:23:23
    Re: Birthday reminder with reminder sent earlier if holiday or weekend

    "Date" simply contains the date for which you want to calculate a reminder date.
    For my convenience I wrote it in a Comose action.

    "Holidays" is also a Compose action and contains an array of holiday dates - here are just a few example dates that do not represent real holidays. In your flow, they should probably come from a list where you keep the holidays.

  • mclim Profile Picture
    53 on 29 Jun 2023 at 13:41:32
    Re: Birthday reminder with reminder sent earlier if holiday or weekend

    Thanks @Chriddle  . I copied your program as-is.

     

    But when I use Date “2023-08-07” and Holidays “2023-07-05”, “2023-08-05”, “2023-08-06” and “2023-08-07” which is identical to your input, the result I got is 2023-08-07 which is a holiday.

     

    Am I missing something? What is your output? TIA.

  • Chriddle Profile Picture
    8,319 Super User 2025 Season 2 on 30 Jun 2023 at 08:02:40
    Re: Birthday reminder with reminder sent earlier if holiday or weekend

    I get 2023-08-04

    Maybe you should check your flow again 😉

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 666 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 382 Moderator

#3
developerAJ Profile Picture

developerAJ 254

Last 30 days Overall leaderboard
Loading started
Loading complete