web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Delete SQL Row when Ta...
Power Automate
Answered

Delete SQL Row when Task is removed from the Planner list of tasks

(0) ShareShare
ReportReport
Posted on by

I Created a flow that gets all the Tasks from Microsoft Planner and Add them as rows in a SQL Database. I am trying to Create a flow that tracks if a Task was deleted from the Planner or it deletes the row from the SQL Database as well. 

 

Please help me!

 

Screenshot 2020-04-07 at 10.25.26.pngScreenshot 2020-04-07 at 10.29.06.png

Categories:
I have the same question (0)
  • JohnAageAnderse Profile Picture
    1,986 on at

    Hello @hadibook 

    You are using two loop to process all the Planner tasks and all the SQL table rows, which will take a long time 🙂

     

    Simplify it by first doing this:

    1. After the List tasks action, initialize an array variable
    2. Use an Apply to each loop to add each Planner task id to the array variable (append to array variable).
    3. You now have all the active Planner task ids in the array variable.
    4. Now comes your action to Get SQL tasks.
    5. Keep your Apply to each loop for the SQL tasks.
    6. Replace the inner loop with a condition - Array variable, Contains, Task ID
    7. If yes, do nothing
    8. If no, delete the SQL task

    By not using a loop within a loop, you will save a lot of time.

    Kind regards, John

  • Verified answer
    v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi @hadibook ,

     

    Please refer to screenshot below to create the flow:

    1.png

    Please make sure there is a column has the same value with the Id of the task, and the column value would be unique, then you could check from each row in the sql table, to see if there is a task in the planner has the same id with the row in the Filter Array action, and if no, delete the row in the sql table.

    The length expression in the flow as below:

    length(body('Filter_array'))

     

    Best Regards,

    Alice

     

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

  • JohnAageAnderse Profile Picture
    1,986 on at

    @v-alzhan-msft (Alice)

     

    I would suggest to move the action List tasks out of the loop, as it will always get all tasks in the planner, so no need to place it inside the loop.

     

    Can you clarifiy - do you know if using a Filter action is faster than a loop getting all values into an array and then using contains in a condition? (just curious)

     

    Kind regards, John

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 459

#3
11manish Profile Picture

11manish 382

Last 30 days Overall leaderboard