TransWikia.com

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

SharePoint Asked by John John on January 2, 2021

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?

Thanks

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!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP