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

Flow to update Sharepoint list on completion of Planner Task

I have a Flow that creates a item in a Sharepoint List when a Task is created in Planner.

 

I then have a second Flow that is triggered whenever a Task is completed in Planner. ThatFlow gets items from the Sharepoint list and filters them by Planner Task ID and updates the Sharepoint List Item that relates to the task that has been created in Planner.

 

There are some circumstances where that second flow doesn't identify the original entry in the Sharepoint list.

 

Where this happens I would like the Flow to create a new item in the Sharepoitn list to state all the details of the Task that has been completed in Planner.

 

I cannot figure out how to write that part of the Flow that recognises when the Planner Task ID has not been found, so I can tell it to then create a new Sharepoint list item.

 

Can anyone help with how I can do this?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Flow to update Sharepoint list on completion of Planner Task

Hi @Walker,

 

Could you please share a bit more about your SharePoint list?

Could you please share a screenshot of your two flows' configuration?

 

I have created a SharePoint list on my side and the data structure of it as below:2.JPG

Note: Planner Task ID column is a Single line of text type column, Task Title column is a Single line of text type column, Start Date Time column and Due Date Time column are both Date type column, IsCompleted column is a Yes/No type column. The IsCompleted column indicates if the task is completed in Planner and the default value of it is No.

 

 

  • When a task is created in Planner, create an item in my SharePoint list:3.JPG

     The flow works successfully as below:4.JPG

     

 

  • When a task is completed in Planner, update the existing task item in my SharePoint list. If the corresponding task item doesn't exist, create a new task item in my SharePoint list to state all details of the task has been completed:
  1. Add a "When a task is completed" trigger.
  2. Add a "Get items" action, specify Site Address and List Name.
  3. Add a "Filter array" action, From set to output of "Get items" action, Within Condition box, left input box set to Planner Task ID dynamic content of "Get items" action, right input box set to Id dynamic content of the trigger.
  4. Add a Condition, click "Edit in advanced mode", type the following formula:
@empty(body('Filter_array'))
  • Within "If/yes" branch of Condition, add a "Create item" action, IsCompleted field set to Yes.
  • Within "If/no" branch of Condition, add a "Apply to each" action, input parameter set to output of "Filter array" action. Within "Apply to each" action, add a "Update item" action, Id field set to following formula:
items('Apply_to_each')?['ID']

Title field set to following formula:

items('Apply_to_each')?['Title']

IsCompleted field set to Yes.

 

Image reference:5.JPG

 

6.JPG

The flow works successfully as below:7.JPG

 

 

Best regards,

Kris

 

 

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

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: Flow to update Sharepoint list on completion of Planner Task

Hi @Walker,

 

Could you please share a bit more about your SharePoint list?

Could you please share a screenshot of your two flows' configuration?

 

I have created a SharePoint list on my side and the data structure of it as below:2.JPG

Note: Planner Task ID column is a Single line of text type column, Task Title column is a Single line of text type column, Start Date Time column and Due Date Time column are both Date type column, IsCompleted column is a Yes/No type column. The IsCompleted column indicates if the task is completed in Planner and the default value of it is No.

 

 

  • When a task is created in Planner, create an item in my SharePoint list:3.JPG

     The flow works successfully as below:4.JPG

     

 

  • When a task is completed in Planner, update the existing task item in my SharePoint list. If the corresponding task item doesn't exist, create a new task item in my SharePoint list to state all details of the task has been completed:
  1. Add a "When a task is completed" trigger.
  2. Add a "Get items" action, specify Site Address and List Name.
  3. Add a "Filter array" action, From set to output of "Get items" action, Within Condition box, left input box set to Planner Task ID dynamic content of "Get items" action, right input box set to Id dynamic content of the trigger.
  4. Add a Condition, click "Edit in advanced mode", type the following formula:
@empty(body('Filter_array'))
  • Within "If/yes" branch of Condition, add a "Create item" action, IsCompleted field set to Yes.
  • Within "If/no" branch of Condition, add a "Apply to each" action, input parameter set to output of "Filter array" action. Within "Apply to each" action, add a "Update item" action, Id field set to following formula:
items('Apply_to_each')?['ID']

Title field set to following formula:

items('Apply_to_each')?['Title']

IsCompleted field set to Yes.

 

Image reference:5.JPG

 

6.JPG

The flow works successfully as below:7.JPG

 

 

Best regards,

Kris

 

 

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

View solution in original post

Walker
Level: Powered On

Re: Flow to update Sharepoint list on completion of Planner Task

Kris - thanks a lot for taking the time to respond - I'm working through implementing this now and will report back once complete.

 

In the meantime, can you explain more about the Filter array action, becuase to me it look slike this is doing the fundamental part I needed help with - determining if there is no positive return, and taking further action if that is the case.

Super User
Super User

Re: Flow to update Sharepoint list on completion of Planner Task

Hi @Walker

 

This is straight from the Microsoft Flow documentation: 

"Use Data Operations - Filter array to reduce the number of objects in an array to a subset that matches the criteria you provide."

 

Here's the example provided in the documentation:

You have the following array - 

[{"first": "Deon","last": "Herb"},{"first": "K","last": "Herb"}]

 After you add the "Data Operations - Filter array" action to your Flow, configure it like the screenshot below.
FilterArray.JPG
Once your Flow runs, the filter array output should look like this:

[{"first": "Deon","last": "Herb"}]

Please let us know if you have any questions.

 

Regards,

Fausto Capellan, Jr

 


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Walker
Level: Powered On

Re: Flow to update Sharepoint list on completion of Planner Task

Thanks Fausto.

 

My original flow used a condition where I asked - does the ID of the Completed Task match the ID of a Task listed in the Sharepoint list - this meant I had 1 where it did, and all the other items counted as "No".

 

I couldn't work out how to then generate a single new entry where there were multiple "No"s.

 

I see now that the array/condition combination instead reduces the number of outcomes to either a single "Yes" or "No" if nothing is found (using the filter), and then checks the output array for whether there is an instance or there is nothing.

 

Very neat.

 

Many thanks for all the help both of you.

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 (5,290)