cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
tonipetrello
Level: Powered On

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!

6 REPLIES 6
Community Support Team
Community Support Team

Re: Check if a Planner Task exists

Hi @tonipetrello,

 

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.
tonipetrello
Level: Powered On

Re: Check if a Planner Task exists

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!

Community Support Team
Community Support Team

Re: Check if a Planner Task exists

Hi @tonipetrello,

 

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.
tonipetrello
Level: Powered On

Re: Check if a Planner Task exists

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

Community Support Team
Community Support Team

Re: Check if a Planner Task exists

Hi @tonipetrello,

 

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.
tonipetrello
Level: Powered On

Re: Check if a Planner Task exists

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,567)