cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jeyeline
Helper III
Helper III

Power automate flow to count the anniversary

Hello Team,

 

I would like to create a power automated flow from the SharePoint list of employees joining date, which trigger mail to the employee with the content of remembering their work anniversary like first, second and so on.

 

Any idea on how it can be accomplished 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @jeyeline 

 

so DOJ is internal name of sharepoint column. So wherever you have used DateOfJoining in flow expression - replace with DOJ instead 🙂

 

This happens because in my case DateOfJoining was internal column name. May be you have renamed the column to name Date Of Joining for the process design , am i right ?

 

Also if your sharepoint list has > 100 items, then you have to enable pagination to access more than 100 items 🙂

 

refer the below for pagination- https://manueltgomes.com/microsoft/powerautomate/what-is-pagination/

 

Thanks & Regards,

Nived N 🚀

LinkedIn: Nived N's LinkedIn
YouTube: Nived N's YouTube Channel

🔍 Found my answer helpful? Please consider marking it as the solution!
Your appreciation keeps me motivated. Thank you! 🙌

View solution in original post

22 REPLIES 22
creativeopinion
Super User
Super User

@jeyeline I cover that scenario in this YT Tutorial: Send Emails Based on a 📆 Date Column in SharePoint with Microsoft Power Automate

 

In this Microsoft Power Automate tutorial, I’ll show you how to build a flow that will send a Happy Birthday email to a user based on a date column in a SharePoint list. The SharePoint list also contains a column with a Manager’s name which we’ll use to send a three-day and day of reminder to the user’s manager.

 

This automation will use the Filter Array action to filter out all SharePoint list items where the user’s birthday is today or in three days. This flow can apply to a variety of scenarios such as:

📅 Student Birthdays

📅 Project Due Dates

📅 Contract/Membership Renewals

📅 License Expirations

📅 Client Anniversaries


IN THIS VIDEO:

How to Send an Email based on a Date Column in SharePoint

Using the Recurrence Trigger in Power Automate

How to Use the Filter Array Action with multiple conditions

How to Get Dynamic Content from a Filter Array Action

How to Get a Date Three Days from Today

How to Create a Dynamic Date Based on utcNow()

How to Return a Count of Items

How to initialize and set a variable

How to use the Send an Email (V2) action

How to send test emails

 

Hope this helps!

If I helped you solve your problem—please mark my post as a solution .
Consider giving me a 👍 if you liked my response! If you're feeling generous— ️  Buy me a coffee: https://www.buymeacoffee.com/acreativeopinion

👉 Watch my tutorials on YouTube
👉 Tips and Tricks on TikTok

Hello @creativeopinion ,

 

I require filter based on year column. Also the triggered mail should show the content based on number of anniversary the current year is in.

 

@jeyeline It would be helpful if you could share a screenshot of your SharePoint list. I'm unclear on what you mean by: the triggered mail should show the content based on number of anniversary the current year is in.

@creativeopinion , my share point list will contain the date of joining across each staff.

Staff 1 - Jan 15,2000

Staff 2 - Jul 1, 2021

 

Now I have to create a flow, where it should sent mail alert to the staff on their date of joining congratulating for their 24th anniversary on jan 15, 2024,
3rd anniversary on the specified date for second case

jeyeline
Helper III
Helper III

Hi @creativeopinion ,

 

 Any solution for this?

 

Hi @jeyeline 

 

Try this approach.

 

I have created a demo sharepoint having employee details with below columns

Nived_Nambiar_0-1708859200959.png

 

Now let's see how to create the flow

 

1. Use a scheduled flow type so to make it run everyday 

 

2. use get items to get all items from SharePoint list

Nived_Nambiar_1-1708859285200.png

 

3. Use initialize variable to initialize years variables which would be storing aniversary years later

Nived_Nambiar_2-1708859335436.png

 

4. use another initialize variable action to initialize rulesjson variables which will be storing suffix details to be added to numbers/aniversary years

Nived_Nambiar_3-1708859389025.png

 

5. use apply to each to loop through each items of get items action

Nived_Nambiar_4-1708859444609.png

 

next steps will be done under the apply to each loop

 

5.1 - use condition to check whether the current date is employee's work aniversary date ?

Nived_Nambiar_5-1708859533651.png

 

Expression used-  formatDateTime(items('Apply_to_each')?['DateOfJoining'],'MM-dd')

Nived_Nambiar_6-1708859589207.png

 

 

If the condition satisfies - all the below steps mentioned will be performed in yes branch

Nived_Nambiar_7-1708859633317.png

 

 

a.  Compute the number of years using an expression in compose action ( i have named the Compose action as Number of years)

Nived_Nambiar_8-1708859686950.png

 

Expression: -  sub(int(formatDateTime(utcNow(),'yyyy')),int(formatDateTime(items('Apply_to_each')?['DateOfJoining'],'yyyy')))

 

 

we will be assigning suffix to the numbers (like th,nd,rd) based on below rule

Nived_Nambiar_9-1708859755285.png

 

b. Use condition to check whether the numbers of years is multiple of 10 or it is >=11 or <=19 

Nived_Nambiar_10-1708859828731.png

 

Nived_Nambiar_11-1708859860352.png

 

Nived_Nambiar_13-1708859887838.png

 

if the above condition is true - use set variable to assign the number of years with suffix like below

Nived_Nambiar_14-1708859932994.png

 

Expression: - concat(string(outputs('Number_of_years')),'th')

 

if condition is false,

Then use the unit digit condition to assign the suffix 

Nived_Nambiar_15-1708860002475.png

 

use the expression in condition to check whether the unit digit of number of years is equal to 1 or 2 or 3 

Nived_Nambiar_16-1708860071092.png

Nived_Nambiar_17-1708860112721.png

 

if the above condition is Yes - use set variable action like below

Nived_Nambiar_18-1708860170055.png

 

Expression:  concat(string(outputs('Number_of_years')),variables('rulesjson')?[last(string(outputs('Number_of_years')))])

 

if condition is False - then use set variable with below expression -

Nived_Nambiar_19-1708860232046.png

 

Expression - 

concat(string(outputs('Number_of_years')),variables('rulesjson')?['Default'])
 
(Both of the expressions used in set variable in above yes/no branch are using data from rulesjson variable to assign suffix based on the unit digit of number of years value)
 
c. use send email to send email to required person/employee using details from sharepoint like below
Nived_Nambiar_20-1708860367836.png

 

 

Results of the flow

 

if the employee date of joining is Feb 25 2001 -> then bot will send an email like this

Nived_Nambiar_21-1708860420547.png

 

Hope it helps !

Thanks & Regards,

Nived N 🚀

LinkedIn: Nived N's LinkedIn
YouTube: Nived N's YouTube Channel

🔍 Found my answer helpful? Please consider marking it as the solution!
Your appreciation keeps me motivated. Thank you! 🙌

 

 

 

 

 

@jeyeline Sorry for the delay. You can follow the YT Tutorial that I've shared with you in a previous post. The only adjustment you would need to make is to add a few actions calculate the anniversary. 

 

For demonstration purposes. I've stored a sample start date into a Compose action and Today's Date in another. You should already have a Compose action in your flow with Today's date (if you've followed the tutorial). In your flow you'll need to pull the correct dynamic content from your SP list.

 

creativeopinion_0-1708876992927.png

 

Get the Years

Add a Compose action to store the year from the employee' start date. Use the formatDateTime() function. 

creativeopinion_1-1708877011893.png

Insert the dynamic content that has the employee's start date. In my flow, I'm using a Compose action—so I've inserted that.

creativeopinion_2-1708877026728.png

Add a comma and single quotes. Between the single quotes enter:

yyyy

This will output the year only.

creativeopinion_3-1708877040902.png

Wrap the entire expression in an int() function. We'll use this function to convert the year into a number.

creativeopinion_12-1708877332983.png

Don't forget the closing parenthesis.

creativeopinion_13-1708877344753.png

Repeat the steps above to get today's year.

 

creativeopinion_5-1708877096092.png

Don't forget to wrap the entire expression in the int() function.

 

Run a test. The Compose actions should output the year from the employee's start date and today's date. Then numbers should be green which will indicate they are integers.

creativeopinion_14-1708877422652.png

Calculate the Difference

Add another Compose action to store the difference between the two years. Add an expression and use the sub() function. The sub() function will subtract two numbers.

 

creativeopinion_7-1708877175241.png

Insert the output from the Compose action storing today's year.

creativeopinion_8-1708877191606.png

Add a comma.

creativeopinion_9-1708877205878.png

Insert the output from the Compose action storing the employee's start date year.

creativeopinion_10-1708877220146.png

Run a test. Review the output to ensure the calculation is correct. You can now insert the output from this Compose action in your Send an Email action. 

creativeopinion_15-1708877549399.png

 

Hope this helps!

 

You might be interested in this YT Tutorial: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows

 

In this tutorial I cover:

 How to troubleshoot a false Condition action result

 How to get dynamic content when it isn’t selectable from the list of dynamic content

 How to troubleshoot an Apply to Each action that isn’t looping through

 How to troubleshoot a skipped Apply to Each action

 How to troubleshoot a Filter Query

 How to use a SharePoint yes/no column in a Filter Query

 How to use Compose actions to troubleshoot a Power Automate flow

How to troubleshoot multiple emails being sent

 How to troubleshoot multiple Teams messages being sent

 

Hope this helps!

If I helped you solve your problem—please mark my post as a solution .
Consider giving me a 👍 if you liked my response! If you're feeling generous— ️  Buy me a coffee: https://www.buymeacoffee.com/acreativeopinion

👉 Watch my tutorials on YouTube
👉 Tips and Tricks on TikTok
 

 

 

 

Hello @Nived_Nambiar ,

I tried with the mentioned flow but encountered errors. Attaching the flow here for reference. Can you guide us in getting it done?

 

 

 

 

 

Hi @jeyeline 

 

I think flow design is correct, but could you let what is the error you are facing ?

 

Thanks & Regards,

Nived N 🚀

LinkedIn: Nived N's LinkedIn
YouTube: Nived N's YouTube Channel

🔍 Found my answer helpful? Please consider marking it as the solution!
Your appreciation keeps me motivated. Thank you! 🙌

jeyeline
Helper III
Helper III

@Nived_Nambiar , Please find the error

jeyeline_0-1709183466406.png

 

Hi @jeyeline 

 

just check whether date column from the sharepoint has any values as null ?

 

Thanks & Regards,

Nived N 🚀

LinkedIn: Nived N's LinkedIn
YouTube: Nived N's YouTube Channel

🔍 Found my answer helpful? Please consider marking it as the solution!
Your appreciation keeps me motivated. Thank you! 🙌

Hi @Nived_Nambiar , 
the SharePoint list contains a date field column with values. No null values are there.

Hi @jeyeline 

 

could you share the expression used in the condition action ? I think column name has changed.

 

Thanks & Regards,

Nived N 🚀

LinkedIn: Nived N's LinkedIn
YouTube: Nived N's YouTube Channel

🔍 Found my answer helpful? Please consider marking it as the solution!
Your appreciation keeps me motivated. Thank you! 🙌

Hi @Nived_Nambiar ,

 

 Thanks for your attention. I have attached all the conditions in the attached zip file for your reference.

 

Let me know the things to be corrected after looking into it.

 

Hi @jeyeline 

 

There is some problem while opening the zip file. Could you share how you have written the condition in a screenshot, that would be helpful.

 

Thanks & Regards,

Nived N 🚀

LinkedIn: Nived N's LinkedIn
YouTube: Nived N's YouTube Channel

🔍 Found my answer helpful? Please consider marking it as the solution!
Your appreciation keeps me motivated. Thank you! 🙌

@Nived_Nambiar , I have applied the precise condition that was provided to me. Since the number of SS (screenshots) has exceeded, I have compressed them and shared.

 

I will share the content in text format once i copied all

Hi @jeyeline 

 

Got it now. So when looking at screenshots- i could see you have exactly used simmilar to mine. Just to confirm, does the Column - Date Of Joining has different name in your list? 

 

Thanks & Regards,

Nived N 🚀

LinkedIn: Nived N's LinkedIn
YouTube: Nived N's YouTube Channel

🔍 Found my answer helpful? Please consider marking it as the solution!
Your appreciation keeps me motivated. Thank you! 🙌

Hi @Nived_Nambiar , I have used the column name as 'Date Of Joining'

 

Hope it will be helpful to investigate further

Ok, But to confirm, could you confirm whether that is DateOfJoining is its internal column name ?

https://www.axioworks.com/support/how-to/find-the-internal-name-for-a-sharepoint-column#:~:text=The%....

 

Also there are 3 records in list which you are iterating through right ?

 

Thanks & Regards,

Nived N 🚀

LinkedIn: Nived N's LinkedIn
YouTube: Nived N's YouTube Channel

🔍 Found my answer helpful? Please consider marking it as the solution!
Your appreciation keeps me motivated. Thank you! 🙌

Helpful resources

Announcements

Take a short Community User Survey | Help us make your experience better!

To ensure that we are providing the best possible experience for Community members, we want to hear from you!    We value your feedback! As part of our commitment to enhancing your experience, we invite you to participate in a brief 15-question survey. Your insights will help us improve our services and better serve the community.    👉Community User Survey    Thank you for being an essential part of our community!    Power Platform Engagement Team  

Tuesday Tip | How to Get Community Support

It's time for another Tuesday Tip, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.       This Week: All About Community Support Whether you're a seasoned community veteran or just getting started, you may need a bit of help from time to time! If you need to share feedback with the Community Engagement team about the community or are looking for ways we can assist you with user groups, events, or something else, Community Support is the place to start.   Community Support is part of every one of our communities, accessible to all our community members.   Within each community's Community Support page, you'll find three distinct areas, each with a different focus to help you when you need support from us most. Power Apps: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pa_community_support Power Automate: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpa_community_support Power Pages: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpp_community_support Copilot Studio: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pva_community-support   Community Support Form If you need more assistance, you can reach out to the Community Team via the Community support form. Choose the type of support you require and fill in the form accordingly. We will respond to you promptly.    Thank you for being an active part of our community. Your contributions make a difference!   Best Regards, The Community Management Team

Community Roundup: A Look Back at Our Last 10 Tuesday Tips

As we continue to grow and learn together, it's important to reflect on the valuable insights we've shared. For today's #TuesdayTip, we're excited to take a moment to look back at the last 10 tips we've shared in case you missed any or want to revisit them. Thanks for your incredible support for this series--we're so glad it was able to help so many of you navigate your community experience!   Getting Started in the Community An overview of everything you need to know about navigating the community on one page!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Ranks and YOU Have you ever wondered how your fellow community members ascend the ranks within our community? We explain everything about ranks and how to achieve points so you can climb up in the rankings! Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Powering Up Your Community Profile Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile. Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Blogs--A Great Place to Start There's so much you'll discover in the Community Blogs, and we hope you'll check them out today!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Unlocking Community Achievements and Earning Badges Across the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. Check out some details on Community badges--and find out more in the detailed link at the end of the article! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Blogging in the Community Interested in blogging? Everything you need to know on writing blogs in our four communities! Get started blogging across the Power Platform communities today! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Subscriptions & Notifications We don't want you to miss a thing in the community! Read all about how to subscribe to sections of our forums and how to setup your notifications! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Getting Started with Private Messages & Macros Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Community User Groups Learn everything about being part of, starting, or leading a User Group in the Power Platform Community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Update Your Community Profile Today! Keep your community profile up to date which is essential for staying connected and engaged with the community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Thank you for being an integral part of our journey.   Here's to many more Tuesday Tips as we pave the way for a brighter, more connected future! As always, watch the News & Announcements for the next set of tips, coming soon!    

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS   Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!   Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!       Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!   UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!   European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!     Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!     For more events, click the image below to visit the Microsoft Community Days website.      

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Users online (2,813)