cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lwine
Regular Visitor

Checking for existing planner tasks - if not create one

Hi Community!

I'm hoping for guidance/help. I have researched other posts but haven't found a solution. I am working on a flow that checks existing planner tasks. If one does not exist, then create one. Seems simple but I'm stuck in a constant loop where it creates the same task multiple times. 

I have confirmed the first condition produces the correct output I need to compare the list of tasks. I have provided screenshots to help describe my workflow. (Side note: I'm generating emails instead of creating tasks for easy cleanup.)


The spName output from the first condition. 
OutputOutput

Workflow:
process and training1.png

Workflow continues:
process and training2.png
Existing Planner tasks. Condition: Title contains spName
(example: Yearly Update: ELMS Assign to Individuals - document owner found contains ELMS Assign to Individuals)
process and training5.png

Emails generated for tasks to be created. These tasks already exist but I'm getting emails stating one should be created. 
process and training3.png

 

Thank you for any help/guidance!

1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Super User
Super User

Hello @lwine ,

you receive the email because you always loop through all the tasks. You take all the tasks, and each of them compare with the new task name. If it's not equal (which will happen for all expect 1 task) you receive the notification.

You should use the 'Filter array' action to search if a task exists, not 'Apply to each' and 'Condition'. I wrote about it on my blog.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

2 REPLIES 2
tom_riha
Super User
Super User

Hello @lwine ,

you receive the email because you always loop through all the tasks. You take all the tasks, and each of them compare with the new task name. If it's not equal (which will happen for all expect 1 task) you receive the notification.

You should use the 'Filter array' action to search if a task exists, not 'Apply to each' and 'Condition'. I wrote about it on my blog.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
lwine
Regular Visitor

Thank you! I will look at your blog post. 😊

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (5,744)