cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Check if a Planner Task exists

I'm definitely new to Flow, but I looked around and haven't seen this yet.

 

I'd like to generate a Task in Microsoft Planner based on emails that come in. That part is fairly straightforward. The issue I'm bumping up against is discovering if a task already exists.

 

I'd like to look through my tasks and check the title (or body) for the "Conversation Id" of the email. If a task with that Conversation Id doesn't exist, then I'd like to create a new one. If such a task DOES exist, I'd like to append the new email text to the Task Description (or maybe add a new comment).

If it comes right down to it, my issue is checking a container for a matching item. I'm just struggling with the "conditions" and "apply to each" (couldn't we just have a "get a match" for different container types?) flow items.

Thanks!

16 REPLIES 16
v-bacao-msft
Community Support
Community Support

Hi @Anonymous,

 

Do you want to use Conversation Id as a basis for judging whether a task exists?

Then I think you need to use Conversation Id as part of the task title, or as a title.

I did a test on my side, please take a try with the following workaround:

   Use the list tasks to get all the tasks, then configure Condition to determine if the task already exists. It is based on whether the title contains Conversation Id.

   If it is included, first use Html to text to get the content of the email body, then use Get task details to get the description of the task, and configure the output corresponding to the above action in the description field.

  If it does not, create a new task with the title containing Conversation Id.

Image reference:

48.PNG

Please take a try.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Barry,

 

Thank you! That's exactly what I needed! I was getting closer to this with trial and error, but your example is exactly what I needed!

 

As far as Conversation Id, I wasn't sure if that was the title of the email, or a unique, underlying identifier. I wasn't sure whether it would be small (and could be put in the Task Title) or large (and should be included in the Task Description).

 

Thanks again, for your help!

Hi @Anonymous,

 

Sorry, there is still a problem with the design of this Flow. I found that there is a problem with the logic for judging whether the planner already exists later.

If this is configured, it will create a lot of duplicate tasks.

I have improved on the basis of the previous, as below:

58.PNG59.PNG60.PNG

Please take a try again and feel free let me know if you have any question.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Barry,

 

Yeah, I noticed that issue. I was trying a bunch of idifferent variable manipulations (which I obviously don't quite understand), but was never quite able to eliminate the duplicates - this was mainly because I had trouble updating details immediately after creating the task (it couldn't find the task 1 step after it was created).

 

Your solution has not revealed a critical step: what is your "condition" at the bottom of the first picture?
And if you can share it, would you mind explaining, in detail, what is happening with your Select and your condition?
(I feel like I can read it, but I haven't been able to come up with the working arrangement yet, so obviously I'm missing a detail or two.)

 

N.B.
The Title probably isn't a great place for the Convo Id: it's a rather long string, and Title is a rather short string.

Thanks again!
Toni

Hi @Anonymous,

 

My mistakes, the screenshots do not seem to be fully presented. I made a change to the location of Conversation Id. If you don't configure it in the Title, you could put it in Description.

It was also made some changes on the basis of the original.

Adding a step is to get the existing Task Description, save it in a String variable, and then determine whether the String contains Conversation Id that in the mail.

If it contains, update Description; if it does not, create a new Task, now you could configure the content you want to configure in Title, followed by update Description, you need to configure the Conversation Id.

The only thing that is unsatisfactory is that if Conversation Id is configured in Description, the execution time of Flow will be longer. Because Description cannot be obtained directly through List tasks.

Image reference:

Overall configuration:

24.PNG

 

Save all Task Description:

25.PNG

Determine if the Task already exists:

26.PNG

Please take a try again.

 

Best Regards,

Barry

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Barry,

 

Thanks again for all your help - it definitely looks like we're getting closer!

Your example definitely seems to cover some new ground for me, but I think I need to create an array that extracts the Task Id, with the Description. Right now (if I'm reading it correctly), you should be updating the last task added to your AllTaskDescription string - not the task that correlates with the conversation Id. Unfortunately, I haven't figured out how to lookup a Task by TaskId...

 

Thanks,

Toni

Hello!

 

Script anyway creating duplicate items...

Hello @v-bacao-msft

I attempted to use this solution for a similar problem I was having. For each existing task that does not match the conversation id a new task is created. This logically makes sense but it is not ideal. I would like for only 1 task to be created if all existing task titles do not contain the conversation id.

 

Thanks in advance!

Hello,

Really good explanation, a question is there in any way possible to limit the number of tasks which are retrieved from Planner?

 

We have alot of tasks in our planner which are done.  

@v-bacao-msft thanks for this, it's providing us with a pretty reasonable ticketing system via. Planner in Teams which is great!

 

For some reason it appears to be running the flow on every ticket in the plan, so in my case creating 65 new tasks (we're using an existing plan with tasks on for testing purposes).

 

After running a second time, it updated 1 task, then created 64 new ones, so the create / update functions are working.

 

I think I need to filter the array produced with the data operation somehow, which I think is what you posted in your second update, but after trying that I'm still getting the same result.

 

Any thoughts?

 

Cheers,

 

KB

Shtroupfette
Frequent Visitor

Good day,

 

I was able to make it work by Initializing a variable of the Title of the tasks 

1- verify if the Subject is in the Value of Tasks if not create a new one if so

2- set the variable ok the Title and validate if the Title match the Subject

 

 

Capture d’écran, le 2021-01-25 à 15.50.07.png

 

RicGer
New Member

my approach to solve the issue in three steps:

-  CreateTitle: Create a unique title to identify individual tasks

-  SearchTask: Filter Array of Tasks based on unique title (Title eq outputs('CreateTitle')

-  CountTasks: Count matching tasks… length(body('SearchTask'))

... shoud be 0 (does not exist) or >0 (minumum of 1 task exist... you may decide further steps with duplicate tasks)

ghazi
New Member

The solution is to loop through tasks. First, initialise a boolean variable (fCreateNew) as true. Then loop through each existing task. If the task exists (and is not completed), update it and set fCreateNew to false. At the end, if fCreateNew is still true, create the new task.

 

(Other solutions create a task for each task that doesn't match the description, so be careful implementing them! I had a hard time deleting all the created tasks!)

 

In my example here, I am create a new task based on an email arriving to a shared folder:

 

ghazi_0-1617172059452.png

Here is the new boolean variable:

 

ghazi_1-1617172099720.png

 

This part will update any task that matches the description AND is not yet complete

ghazi_2-1617172177957.png

 

The variable above is set as follows:

ghazi_3-1617172275289.png

 

After every task has been looped through, if fCreateNew is still true, then a new task can be created as follows:

 

ghazi_4-1617172337708.png

 

Hope this helps!

 

Anonymous
Not applicable

The solution of @ghazi works perfect for me!

 

the only problem I'm running into now is that I can't refer a task to a person.

Does anyone have a genius solution to solve this?

Thanks for this - a simple, clever solution to the problem I had here (basically the same as the OP, but with buckets rather than tasks).

I tried this and I still get unended tasks created.  I'm adding it to a code where it pulls the attachments if they exist.

helpwithautomat_0-1646889429901.png

helpwithautomat_1-1646889467219.png

helpwithautomat_2-1646889508233.png

 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,361)