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.
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.
Please take a try.
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!
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:
Please take a try again and feel free let me know if you have any question.
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.)
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.
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.
Save all Task Description:
Determine if the Task already exists:
Please take a try again.
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...
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!
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.
Three Super User rank tiers have been launched!
Features releasing from October 2020 through March 2021
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!