How i can get all the users' responses before updating the list item inside my MS Flow

I have the following MS Flow:-

enter image description here

enter image description here

and i have a SharePoint list with an Approvers field as follow:-
enter image description here

Currently i got this scenario:-

  1. let say i create a new item >> set the Approvers fields to UserA & UserB.

  2. then both users will get an approval request.

  3. but when the first user Accept the request >> the status for the item will be changed to Resolved..

While what i am trying to achieve it to wrap all the users’ responses and then update the status, as follow:-

  1. if all users Approve then the status will be set to Resolved

  2. if all users Reject then the status will be set to Closed

  3. if some users approve while the other reject, then the status will be set to "Partially Approved"..

so i do not want to update the status until all users provide their responses…

so can you help on how i need to modify my flow to implement the above?


SharePoint Asked by John John on January 2, 2021

1 Answers

One Answer

I think you can accomplish this with the following steps:

  1. Declare an Array variable to collect [Outcome] from all approvers
  2. Within the [Apply to each] loop, use [Append to array variable] action to append the [Outcome] to the variable
  3. Outside the [Apply to each] loop, apply the business logic to the values in the array to come up with the Final Status, and then update the list with [Update Item] action

Screenshot showing my test case

enter image description here

Outcomes from all Approvers

enter image description here

The expression to determine the Final Status

if(and(contains(variables('varApprovalStatus'), 'Approve'),contains(variables('varApprovalStatus'), 'Reject')), 'Partially Approved',if(and(contains(variables('varApprovalStatus'), 'Approve'),not(contains(variables('varApprovalStatus'), 'Reject'))), 'Approved','Closed'))

You can test the logic separately as shown in the screenshot below

enter image description here

The Final Status for this example enter image description here

Answered by Matiur Rahman on January 2, 2021

Add your own answers!

Related Questions

Is there an API or web service for Copy-SPSite?

0  Asked on October 25, 2021 by spdevadmin


Calculated Fields and Outputting to Excel

1  Asked on February 28, 2021 by brandon


PnP with .NET Core

1  Asked on February 23, 2021 by thomas-segato


How can I use MS Web Test to upload files to SharePoint?

2  Asked on February 19, 2021 by user1258


Filtering List View by Current User Email

2  Asked on February 18, 2021 by hushhoney


Ask a Question

Get help from others!

© 2022 All rights reserved.