cancel
Showing results for 
Search instead for 
Did you mean: 
AlanPs1

Send A Happy Birthday Email Message Without The Use Of A List

Quite regularly I hear requests that centre around wishing users a Happy Birthday within an organisation. There is an extremely popular template within the Flow template gallery that does just that, it is called "Send a Happy Birthday email to employees on their birthday" and it uses a SharePoint list. It work's really well, although sometimes date formats can become an issue for the Flow implementer when they are imported from the list.

Also, the organisation's users need to be added to the list itself in advance. Whilst that isn't a huge chore for most people, below is a process that requires no list and will send an email to every enabled user in your O365 tenant at 9am on the day of their birthday.

 

Sound, interesting?

 

Well, read on and follow the steps and you too will be able to implement this process.

 

Your email will look like this.

 

Pre-requisites: You will need a suitable Office 365 group. This may be an "All Users" group or a segmented group that only has users who have agreed to recieve such an email. Maybe it's a group that omits the CEO or those who may not celebrate their birthday. I will leave that to you to decide, but in this example a pre-configured "All Users" group is in use.

 

Here is the complete Flow.

 

 

Let's get started by creating a blank Flow and setting the trigger. The trigger in this case is a "Recurrence" which will be set to run at 9am daily with a start date that means when implemented, it will run like clockwork on the hour.

Note: The start date is in this format – 2019-03-20T09:00:00Z. If your in a non UTC timezone the "Z" at the end will not be required.

 

Here is the trigger.

 

We then use the "List group members" action from the "Office 365 Groups" connector. I have named it "List All Users" by click the elipses (…) in the top right.

 

As there are likely multiple users in your organisation then we will need to set an "Apply to each" to allow us to iterate through each one checking to see if it is the user's birthday or not. We will call it "Apply To Each User Account In All Users".

 

Time to use the "Office 365" connector and the action called "Get user profile (V2)".

 

The next step covers the all important condition. It checks if it is the user's birthday and it makes sure the group member is set to "enabled". No need to be wishing those disabled accounts (leavers or shares) a Happy Birthday.

 

 

1.

formatDateTime(body('Get_user_profile_(V2)')?['birthday'], 'MM-dd')

is equal to

formatDateTime(utcNow(), 'MM-dd')

2.

body('Get_uer_profile_(V2)')?['accountEnabled']

is equal to

true

3.

body('Get_uer_profile_(V2)')?[birthday']

is not equal to

0001-01-01T00:00:00Z

 

There is no need for the No branch in this Flow as it will run successfully with no output if no-one has a birthday on that day.

 

For the Yes branch.

 

We add the user to an image or gif. You can get to the url of the image here: http://bit.ly/2TWrfQe

 

 

We now use the above web based url in the email body with the "Send an email" action. This means if you want to change the image you can.

 

So there we have it, you now have a neat Happy Birthday process that targets any group in Office 365.

 

Thanks, Alan

 

AlanPs1.io

Comments

This is neat! I now have a flow that posts to Teams whenever a member of our team has a birthday 🙂

Hi @bottekott 

Thank you for the feedback and I am stoked to see you have amended this model to post to Teams. That is very neat!

 

I'd love to see your method and I'm sure the community would to. Maybe you could make a post in the "Flow Cookbook" referencing this post and detailing the further enhancements you have made?

 

If you decide to, please tag me and I will be sure to check it out. Smiley Happy

 

Thanks, Alan

Hi @AlanPs1 

I just replaced the compose and send an email steps with the "post a message to teams as the flow bot" action.

 

I was thinking of getting fancy with an adaptive card using the new connector , but could not figure out a way to dispay the profile image of the user.

Anonymous

It is a great find!

Personally I used the SharePoint Search engine to get me my initial results. With search I can search for a specific day and eliminate all users that are not relevant.

Hello @AlanPs1 

from where does it takes the birthday dates?

the contact in office 365 doesn't have this field.

@Anonymous @bottekott 

Hi @yossi , essentially it's Delve profile. The "Get user profile (V2)" action returns that.

It can be set in Delve, maybe other places and can be accessed with PowerShell too.

Thanks, Alan

Anonymous

Hi @AlanPs1 I am getting one problem. Everyday birthday mail is sent to all members in the group. How to fix that?? Where I am missing ?? Thanks in advance 

Hi,

Thank for the wonderfull article. I'm now at the question, How can we apply the following logic?

 

1.) recurrence, Mon To Friday except,

2.) On Friday, Add the birthdays that are occuring on the weekend.

 

Busy trying...

PS, Instead of sending individual emails, how would one collect everyone on the day and apply their name in the email construction? 

 

Kind Regards,

Rayno

I have been running this flow for sometime now and I use it to post an announcement to Yammer it works great, however one of my supervisors asked if they could get a reminder a week before a birthday so they can buy a birthday card. What would that formula look like?

Thanks in advance.

Anonymous

hi @AlanPs1 , that's great stuff. Thanks for sharing. Do you know how I cand send email as a Team HR instead my own, work email?

Anonymous

NVM - I managed to find "Send an email from shared mailbox."

Anonymous

Hi Alan

I have customized image stored on O365 sharepoint. how can i use that. I tried using above but no luck still not displaying in email body

@Willerz7071 did you ever got an answer to your question? I'm struggling with exact the same thing. I would like to send a reminder to the rest of the team, except the birthdayboy. I can't find a way to filter that email address out.

hey there, 

Can anybody please help me.  I'm not getting this to work on my side...I've managed to setup the 1st two steps but then it goes bang...

Is there somehow you can give someone with no developing or coding experience some help. I'm trying to create this automation for our internal and external clients and vendors.....and also what is the date format for this thing...can it only work from outlook or can excel sheet work as well..?  what is the criteria from the list? How do you get the birth date from/ on an Outlook Contact list?

Anonymous

Maybe anyone know why my flows works fine but look , in the practice said does not work, but is fine is sending the email, see the image for understanding my point:

 

Jovalles_0-1594670382206.png

 

@Anonymous : all I can see from your screenshot is that you apply for every team member (12) the get profile action and this returns a false value in your condition (don't know what your condition is exactly but it doesn't match the profile you are getting) for the first user.

If an email is being send it probably matches for one of the other 12 members, you can check this by clicking the arrows in the top right of your screenshot

Hi, could you please point me in the right direction here? I can't see the option of sending this as HTML, the only option that works for me is Send and email with conditions.  But I guess the send an email used here is discontinued? 

 

Thanks in advance

Hi @sajarac ,

 

the option to send as HTML has indeed been removed but has been replaced by the "< />" button in the body of the email field. You can add your HTML code in the default editor

It seems like you are the only person working in this forum in this holiday season....

 

Would you mind to check this post and please let me know how can I achieve it?

 

thanks in advance

 

https://powerusers.microsoft.com/t5/General-Power-Automate/Sending-an-Email-Reminder/m-p/776605#M625...

Anonymous

I have the same issue as @Anonymous, the flow doesn't work when using an image saved in SharePoint. Does anyone have any idea how to fix this? 

point @3 condition not able to apply can you please explain a bit more, I am using SharePoint List where we stored all the DOB information.

Hi,


Thanks a lot for this flow, that is what I needed as well.

 

I tried to make it work but I have some difficulties when it goes to the condition section. It keeps saying: 

 

"Unable to process template language expressions for action 'Condition' at line '1' and column '17863': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'."

 

Do you have any idea why this may happen ?

Thanks,

Thank you @AlanPs1 it works in my environment, the end user needs to update the birthday date on her Delve profile

Birth_Date.jpg

The flow works well

Flow1.jpgFlow2.jpg

Thanks 👋

I coundn't find the "Send a Happy Birthday email to employees on their birthday" template on the Power Automate templates page the URL https://emea.flow.microsoft.com/en-us/galleries/public/templates/b6e38eb5fda442069ea2acf299a31d3e/se... seems to be broking.

Can someone share it again?

Thank you

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/