cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lina_Ju
Helper II
Helper II

Create a task in planner, once an email is moved to a folder in outlook

I've created a flow which is triggered, once a mail is moved to a certain folder in outlook.
After that, I creates a task in MS Planner.

Lina_Ju_0-1712998974118.png

I only have the problem, that it creates one task per mail, but I need it to create as many tasks as receivers of the mail and assign it directly to the receivers one by one.

This is my expression for the compose action:

split(triggerOutputs()?['body/toRecipients'],';')

This is for the apply to each:
Lina_Ju_1-1713005743866.pngLina_Ju_2-1713005774836.png

 


Thank you in advance.


20 REPLIES 20
creativeopinion
Super User
Super User

@Lina_Ju The logic of your flow needs to be adjusted. Take a look at your Apply to Each action. You are loop through each item returned from the Filter Array action. 

creativeopinion_0-1713027686366.png

 

You are using the Filter Array action to filter out the buckets that match the names of the recipients of the email. 

creativeopinion_1-1713027719163.png

Each time your Apply to Each action loops through an item in the Filter Array action, it'll create a task.

 

---

Manual Trigger

Any time I'm building a flow that involves the When a new email arrives trigger—I like to create a manually triggered flow for testing. This speeds up the flow building process so I don't need to leave Power Automate, compose an email just to trigger the flow.

 

You can get the Message ID from a flow run by inserting the Message ID dynamic content into a Compose action and sending yourself an email. 

creativeopinion_1-1713041377366.png


Alternatively, you can get the message id from a previous flow run by clicking on Click to Download in the Outputs of your flow trigger.

creativeopinion_2-1713041423209.png

 

Search for "id", and highlight the id between the double quote marks and copy that to your clipboard.

creativeopinion_3-1713041488742.png

 

 

A compose action is optional as you can insert the Message ID directly into the Message ID field of the Get Email (V2) action. However, I prefer to use a Compose action. 

creativeopinion_0-1713041250856.png

 

Get Array of Email Addresses

The output of the recipient dynamic content from the Get Email action is a string of email addresses. Each email address is separated by a semi-colon. 

creativeopinion_4-1713041555647.png

To return the email addresses in an array (which you can then loop through) you will need to use an expression. Add a Compose action an insert an expression. Use the split() function. The split() function takes two parameters:

split([string of text],[separator])

creativeopinion_5-1713041621851.png

Click on the dynamic content tab and insert the To dynamic content into the split() function. 

creativeopinion_7-1713041680460.png

Add a comma and a semi-colon between the single quotes.

creativeopinion_8-1713041751006.png

 

Run a test. Review the outputs of the Compose action. The string of email addresses should now appear as an array.

creativeopinion_9-1713041816976.png

 

********************ADDED INSTRUCTIONS********************

Loop through Each Email Address

You need to loop through the array of email addresses from above. Add an Apply to Each action. 

 

Insert the output from the Compose action above that contains the recipient array. This Apply to Each action will loop through each email address (from the Compose action above). The Apply to Each action requires an array of items to loop through. 

creativeopinion_1-1713794408346.png

 

Add a Compose action. This action is optional, however I like to use Compose actions to help troubleshoot. It can also help you to better understand your flow as you are building it. You'll use this Compose action to return the firstname.lastname from the email address.

 

Add an expression and insert the split() function. The split() function takes two parameters:

split([string of text to split],[separator to split at])

creativeopinion_0-1713794399232.png

 

Enter the item() function. This will return the current item you are looping through (aka the email address). Add a comma.

creativeopinion_2-1713794622066.png

 

Between single quotes, enter the @ symbol.

creativeopinion_3-1713794663098.png

 

Press OK and run a test. Review the outputs. The split() function will split your string of text (the email address) at the separator (the @ symbol) into an array of items.

 

Since you want to only return the first item in the array (firstname.lastname) in your case, you'l need to adjust the expression. 

creativeopinion_4-1713794720146.png

Click on the expression to edit it. Wrap the entire expression in the first() function. Don't forget to press Update.

creativeopinion_5-1713794793607.png

 

Run another test. Review the outputs. The Compose action should now output the first part of the email address (before the @ symbol)

creativeopinion_6-1713794835014.png

 

To learn more about the Apply to Each action—check out this YT Tutorial: 3 Mistakes YOU 🫵 are Making with the Apply to Each Action in your Microsoft Power Automate Flow

 

Filter Out Bucket

Add a Filter Array action. Now you can use the Filter Array action to filter out the bucket. For more info on the Filter Array action—check out this YT Tutorial: Are you using the Microsoft Power Automate Filter Array Action wrong?

creativeopinion_7-1713795055398.png

 

Create Item

The Filter Array will return an array of items — even if it's a single item. To prevent another Apply to Each action from being automatically added to your flow when you try to access the Bucket ID, you'll need an expression. Without an expression your Create Item Action will nest itself inside an Apply to Each action—which isn't want you want.

creativeopinion_8-1713795336154.png

 

Hover over the Id label—take note of the text between the square brackets and single quotes. This is the dynamic content key for the bucket id. Important: It is case sensitive.

creativeopinion_9-1713795397747.png

 

Remove the ID dynamic content from the bucket id field and pull the Create a task action outside of the Apply to Each action (that was automatically added). Delete the Apply to Each action that was automatically added.

creativeopinion_10-1713795473586.png

 

In the Create a Task action, insert an expression into the Bucket Id field. Start off with:

?[0]['id']

The Filter Array action will only ever return a single item (single bucket for each recipient)—the zero in the expression above indicates you'd like to return the first item in the array. The text between the square bracket indicates you want to return the bucket id. 

creativeopinion_11-1713795522705.png

Place your cursor at the start of the expression by pressing the UP arrow key. Click on the dynamic content tab and insert the body dynamic content from the Filter Array action.

creativeopinion_12-1713795621777.png

creativeopinion_13-1713795630632.png

Fill out the rest of the fields in the action. Keep in mind, if you are adding multiple email addresses to the Assigned User Ids (as you did in your original flow) you need to separate each by a semi-colon.

creativeopinion_14-1713795767437.png

Also, because you want to assign the task to each recipient, you cannot use the To dynamic content as this contains all recipients. You need to use the Current Item dynamic content (aka the email address).

creativeopinion_15-1713795838531.png

If you want to assign the sender as well (which is what it looked like you were trying to do, don't forget to add a semi-colon.

creativeopinion_16-1713795891309.png

 

 

Question:

Can you clarify what you want your flow to do? Do you want to create one task and assign all users to the one task? Or do you want to create a task for each recipient (all with the same details)?

 

----

 

In the meantime you might find these Planner YT Tutorials helpful: 

️Automate Microsoft Planner Tasks: Create Tasks from SharePoint & Excel in Minutes

 

Do you want to quickly create tasks in Microsoft Planner from a SharePoint list or an Excel table? In this Microsoft Power Automate tutorial I’ll show you how to build a flow that will:

️ Create a task in Planner for each of your SharePoint list items

️ Create a flow that will trigger each time a new SharePoint list item is created

️ Create a tasks in Planner from an Excel Table

️ Add a description to your tasks

 

IN THIS VIDEO:

  How to bulk create Planner tasks from a SharePoint List

  How to use the Get Items action with a filter query

  Tips on creating a fast flow while building and testing

  How to create a string of email addresses from a multi-person choice column

  How to dynamically select a bucket in the Create a Task action

  How to use the Filter Array action

  How to use the Condition action

  How to use the Create a Task action

  How to automatically create a Planner task when a new SharePoint list item is created

  How to bulk create Planner tasks from an Excel Table

  How to add a task description to a Planner Task

 

---

 

How to Email Attachments 🖇 to Your Planner Tasks

When you add attachments to a Planner task from your computer, the files are automatically saved in the Documents document library of the SharePoint site associated with the M365 Group of your plan. Instead of downloading email attachments to OneDrive or SharePoint just so you can add them to a Planner Task—automate it.

 

In this Microsoft Power Automate Tutorial—I’m going to show you how build a flow that will take your email attachments and add them to a Planner task. All you need to do is copy a link to a task, forward the email to yourself and the attachments will be saved onto SharePoint and attached to your planner task. Stay tuned till the end of the video where I’ll show you how to use Trigger Conditions so this automation only runs when specific conditions are met!

 

IN THIS VIDEO:

 How to get the Message ID from an Email

 How to use the Get an Email (V2) action with a Manual Trigger

 How to use the split() function to split an email subject line

 How to use the Scope action to group your actions

 How to create a folder for email attachments on SharePoint

 How to use the Get Attachment (V2) action

 How to create attachment files in SharePoint

 How to use the Append to Array variable action to collect attachments

 How to add multiple attachments to a Planner Task

 How to switch a manual trigger to an automated trigger

 How to use Trigger Conditions in a when a New Email Arrives Trigger

 How to trigger your flow when only specific emails arrive

 

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!

👉 Level up your Power Automate skills by checking out my tutorials on YouTube
👉 Tips and Tricks on TikTok and Instagram

Dear @creativeopinion,

thank you for your answer. I want to create as many tasks as recipients in the email. This can vary from mail to mail. The tasks should always look the same for each person per Mail. Best case I want to automatically assign the tasks in planner to the recipients.
Thank you!

@Lina_Ju Can you provide insight to this action you had in your original flow? 

creativeopinion_0-1713189809040.png

 

@creativeopinion, sure this is the action I am using: 

split(items('Apply_to_each'), '@')[0]

@Lina_Ju Sorry can you please provide more clarity on the names of your bucket? From what I can gather, from your original flow you had the Filter Array nested inside the Apply to Each action which was intended to loop through each recipient. 

 

It would appear as if you are trying to use the Filter Array action to filter out your buckets by recipient. However, in your original flow I believe you were looping through each Recipient's email address. I need clarity on how your Planner is set up. Do you have a bucket for each recipient? Is each bucket name the email address of each recipient?

creativeopinion_1-1713277551026.png


The more insights you can share—the easier it is to provide recommendations.

 

Lina_Ju
Helper II
Helper II

Dear @creativeopinion,
Yes, I have different buckets for each recipient, titled with "firstname.lastname" (as in the e-mail).

Lina_Ju
Helper II
Helper II

Dear @creativeopinion
do you have any idea on how to solve this?
Thank you!

Lina_Ju
Helper II
Helper II

@creativeopinion 
for more insights, this is the error I receive:

Lina_Ju_0-1713783229721.png

 

@Lina_Ju I've updated the original post with additional instructions based on your most recent info. Hope this helps!

Lina_Ju
Helper II
Helper II

Dear @creativeopinion,
thank you so much. The flow runs through smoothly, but sadly the task does not get created.

Lina_Ju_0-1714379254447.png

 

@Lina_Ju The reason the task isn't being created is most likely because the Filter Array action isn't returning any items. You'll need to troubleshoot this step of your flow.

creativeopinion_0-1714400099332.png

To do that you need to confirm if in fact the name of the buck matches the Compose action above. When using the is equals to operator.. you need an exact match.

 

 

Lina_Ju
Helper II
Helper II

Dear @creativeopinion,

this is the compose action:

Lina_Ju_0-1714482247873.png

The name of the single buckets in the planner is firstname.lastname

@Lina_Ju When you run a test what is the output of the Compose action? You need to review the output and compare it to the name of the buckets in your planner. 

creativeopinion_0-1714486622253.png

If the Filter Array finds a bucket with a matching name, it'll appear in the Outputs of the Filter Array action.

creativeopinion_1-1714486739781.png

If the output displays a [] this means no matching bucket was found. You'll need to scroll through the Inputs of the Filter Array action and review the names to see where the discrepancy is.

 

Lina_Ju
Helper II
Helper II

Dear @creativeopinion,

Lina_Ju_0-1714653576634.png

The output shows [] but the bucket is called exactly like the name in the output.

@Lina_Ju As mentioned previously, the values entered into the Filter Array action are case sensitive. You'll need to ensure the values match in case. If you aren't sure how to do this—please refer to this section of my YT Tutorial. 

creativeopinion_0-1714678262645.png

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!

👉 Level up your Power Automate skills by checking out my tutorials on YouTube
👉 Tips and Tricks on TikTok and Instagram

 

Lina_Ju
Helper II
Helper II

Dear @creativeopinion,
I've checked it and changed it accordingly, but the task still cannot be created:

Lina_Ju_0-1714744404239.png

 

@Lina_Ju You have an extra Apply to Each action here which isn't required. 

creativeopinion_0-1714745597333.png

Also, the Assigned to User IDs should be a string of email addresses. This isn't what you have here.

creativeopinion_1-1714745632077.png

Please refer to the Create Item instructions in my original post above.

 

Lina_Ju
Helper II
Helper II

Dear @creativeopinion,
I tried to do this upfront, but the expression is invalid, when I want to apply it:

Lina_Ju_0-1714975876314.png

 

@Lina_Ju That's odd. Can you try to put the expression into a Compose action above the Create a task action? If that works, then you can insert the output of the Compose action into the Bucket ID field.

Helpful resources

Announcements

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

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including 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 link below to sign up today! https://aka.ms/PowerUp  

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!

Users online (5,191)