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

Notifications

Announcements

Community site session details

Community site session details

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

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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard