cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lwine
Frequent 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. ]

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

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,761)