Skip to main content

Notifications

Community site session details

Community site session details

Session Id : BRm+3DQxUOlECmJ8z9bSOG
Power Automate - General Discussion
Answered

Birthday email to user and others

Like (0) ShareShare
ReportReport
Posted on 5 Feb 2023 01:59:30 by 30

I am trying to build a flow that would extract birthday dates from an excel file, compare today's date via a condition, send an email to the person celebrating the birthday and also send an email to other people telling them that this person is celebrating their birthday. Also if there is more than one person's birthday on that day it would generate an html table. Please help. Thank you for your time and assistance.

  • KoenM Profile Picture
    19 on 21 Feb 2023 at 12:30:00
    Re: Birthday email to user and others

    this is the flow 5 days ahead:

    KoenM_0-1676982570222.png

     

    - recurrence every day at the time you want the mail to be send

    - get items from sharepoint list

    - calculate today: formatdatetime(UTCNow(),'dd-MM')

    - calculate today+5: formatdatetime(addDays(utcNow(),5),'dd-MM')

    - init varpictureURL (optional) as String 

    - init varBirthdayboy as String

    - init varOthersEmail as Array

    - init varGetBirthDateFromSP as String

    - check if birthday occurs (parallel branch):

    KoenM_1-1676982570232.png

     

    for every value in the Sharepoint List:

    - compose the birthdate from SP: substring(get items(dayofbirth),0,5) to get it in the same format

    --> branch condition birthdayboy: if outputs(today + 5) = outputs(birthdate from SP) you know that in 5 days a birthday is coming up

    - if yes: append that name to a string varbirthdayboy

    - append pictureURL to varPictureUrl (totally optional)

    - append to string varGetBirthdateFromSP: outputs(birthdate from SP) --> you will need this later on

     

    KoenM_2-1676982569774.png

     

    --> branch condition othersemail

    - if outputs(today + 5) not equals outputs(birthdate from SP) you know that it's not that persons birthdate

    - if yes: append the email address to varOthersEmail

     

    Right now you will have to variables: Varbirthdayboy will contain the name of the birthdayboy and varothersemail will contain all the email addresses of the others. Let's check if it's actually somebody's birthday today (outside the loop):

    KoenM_3-1676982570231.png

     

    - if the length(varbirthdayboy) not equal to 0 (it's somebodys birthday)

    - yes: compose the TO address of the mail: join(variables('varothersemail'),';') --> because this was an array it will join all the email addresses with a ';' into one string that you can use in your TO field of your mail

    - send an email: "our colleague 'varbirthdayboy' has a birthday coming up in 5 days"

    TO = output(compose TO address)

    subject = in 5 days it's the birthday of "varbirthdayboy"

    -if no: terminate the flow because it's nobody's birthday in 5 days

     

    This works for small teams and you need to maintain the sharepoint list (or excel if you like) manually. Joiners and leavers should be updated regularly

  • KoenM Profile Picture
    19 on 21 Feb 2023 at 12:28:40
    Re: Birthday email to user and others

    This is a copy of the message I send earlier:

    I actually split up the process in 2 flows. 1 that will send a warning mail 5 days ahead of your birthday to everyone in your team (sharepoint list with name, email and birthdate) and 1 flow that actual sends a message in teams on the day of your birthday.

    This is the flow on the day of your birthday:

    KoenM_0-1676982387419.png

     

    - Recurrence every day at the moment you want the message to be sent

    - get items from your sharepoint list

    - calculate today in format dd-MM

    - initialize a string var for Birthdayboy

    - check when the birthday occurs:

    KoenM_1-1676982387286.png

     

    - for every value in your sharepoint list

    - birthdate from SP: substring ('DOB' 0,5) to get the same mm-DD format (we don't care about the year, how old he got)

    - get birthday picture: if you like a picture to be send in the message, we had a personalized picture

    - condition birthdayboy: if outputs(Today) = outputs(birthday from SP) --> today would be 07/02 and somebody on your sharepoint list would have his birthday today it would also be 07/02 (watch out for the format in your SP List)

    - if yes: it's someone's birthday (possibly more) so append the name to a string varbirthdayboy

    - post the message to teams in some channel: "To our colleague varbirthdayboy, happy birthday"

    - set the varbirthdayboy back to Null, otherwise for the next birthday boy it will still remember the first name. Remember that you are still in a loop here so it will post a message for every one separately if they would have their birthday on the same date.

     

    Hope this makes sense, otherwise hit me back.

     

    btw: I made this a long time ago, now I do this for larger teams using a dynamic way based on Active Directory membership so there is no sharepoint list to be maintained anymore. Especially handy when people leave or join the company/team frequently

  • michaelhuo Profile Picture
    2 on 21 Feb 2023 at 10:26:06
    Re: Birthday email to user and others

    can you also share me the example for this flow? I want to build a same flow. thanks!

  • Verified answer
    AndrewJr Profile Picture
    30 on 19 Feb 2023 at 10:27:50
    Re: Birthday email to user and others

    The flow you sent me was perfect. Thank you.

  • KoenM Profile Picture
    19 on 07 Feb 2023 at 21:24:44
    Re: Birthday email to user and others

    Hi @AndrewJr 

    I just messaged you with an example of my flows. I use a sharepoint list instead of excel but the principle is the same.

    I also split the process in 2 separate flows, probably it's doable in 1 but it worked for me this way. Let me know if that's what you need.

    Just a reminder that excel and sharepoint are good for small teams or groups but it requires manual maintenance if people join or leave the team. Better is to query Active Directory and filter on team and then retrieve the birthdate (if it's stored in AD for your company off course, otherwise you're stuck with a list)

  • AndrewJr Profile Picture
    30 on 07 Feb 2023 at 15:08:39
    Re: Birthday email to user and others

    Hi v-bofeng-msft.

     

    Thank you for quick response and SUPERB flow however I am requesting assistance with a flow that:

     

    1. Check birthdates against today's date.

    2. Send individual email (s) to today birthday recipient(s). 

    3. Send individual emails to non-birthday personnel letting them know that today is someone (s) birthday (s) with the name of the birthday recipients(s) in the body of the email.

  • v-bofeng-msft Profile Picture
    on 06 Feb 2023 at 02:51:22
    Re: Birthday email to user and others

    Hi @AndrewJr ,

     

    I've made a test for your reference:

    1\I assume there is a table:

    vbofengmsft_1-1675651535681.png

     

    2\My flow

    vbofengmsft_5-1675651864026.png

     

    vbofengmsft_4-1675651830579.png

     

     

     

    3\Result

    vbofengmsft_2-1675651684805.png

     

    Best Regards,

    Bof

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - General Discussion

Overall leaderboard