cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ksod
New Member

Tracking approvals from multiple users in a document library

Hello, 

I am building a workflow from a SP document library where multiple users need to approve documents once they are out of the draft stage and submitted for approval (i.e. 'Pending'). The workflow is able to send the approval request out to each user using "Start and wait for an approval" and is specified "custom responses - Wait for all responses". Note: users will change on each document, so I am using dynamic content to set the approvers with their email. However, the status of the document is automatically updated to "approved" when the first user responds. I created a "somewhat" workaround, where each users approval gets listed in another column using a string variable, but this makes the properties of the document change and then it reverts to a draft status. I am not using this workaround as it defeats the purpose of having the approval status in the first place.

 

The flow is as follows:

 

Trigger: When an item or file is modified

Trigger Condition- @equals(triggerOutputs()?['body/{ModerationStatus}'],'Pending')

 

Get file properties

 

Get file metadata 

 

ksod_0-1659976284824.png

 

ksod_1-1659976319676.png

ksod_2-1659976350034.png

ksod_3-1659976396173.png

 

ksod_4-1659976436735.png

 

 

I am very new to Power Automate, so any feedback on this will be useful. It would be great if the status could remain pending until all users have approved the document or at the very least - let me know who has approved/hasn't approved without reverting the status to 'Draft'. 

 

Thanks, 

ksod

 

 

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
edgonzales
Super User
Super User

@ksod 

Hey there....so here's what's happening (great work so far, btw!)

 

The variable that you've created for the approvals is an Array (list), so when you create the approval and listed that variable as the assigned to, Power Automate automatically kicked off an Apply to Each loop.  So, it starts working through your list of approvers and creates a different approval for each one.  That's why the first one to approve kicks off all of the "approved" stuff.

 

The fix is to shift that variable to a String, and append each new name with a semi-colon in between.   That way, Power Automate won't put it inside a loop, and will create a single Approval with multiple people rather than multiple approvals with just one person on it.

 

Once you do that, you will only have a single "Outcome" so you can get rid of that variable and that loop, right?

 

Hopefully, that's enough to move your game piece to the next square.   Good luck, and keep us posted.

 

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

View solution in original post

Ed, 

 

Ah! This worked. Here's how I did it. Now, the status remains 'Pending' until all approvers have responded! I still have the responses "apply to each" so that I receive a teams message with each approval, but that can be changed as well.

 

ksod_0-1660055157237.png

 

Thank you for your help, I was stuck on this for a while!! 

 

- Kristen

View solution in original post

2 REPLIES 2
edgonzales
Super User
Super User

@ksod 

Hey there....so here's what's happening (great work so far, btw!)

 

The variable that you've created for the approvals is an Array (list), so when you create the approval and listed that variable as the assigned to, Power Automate automatically kicked off an Apply to Each loop.  So, it starts working through your list of approvers and creates a different approval for each one.  That's why the first one to approve kicks off all of the "approved" stuff.

 

The fix is to shift that variable to a String, and append each new name with a semi-colon in between.   That way, Power Automate won't put it inside a loop, and will create a single Approval with multiple people rather than multiple approvals with just one person on it.

 

Once you do that, you will only have a single "Outcome" so you can get rid of that variable and that loop, right?

 

Hopefully, that's enough to move your game piece to the next square.   Good luck, and keep us posted.

 

-Ed

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Ed, 

 

Ah! This worked. Here's how I did it. Now, the status remains 'Pending' until all approvers have responded! I still have the responses "apply to each" so that I receive a teams message with each approval, but that can be changed as well.

 

ksod_0-1660055157237.png

 

Thank you for your help, I was stuck on this for a while!! 

 

- Kristen

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (1,483)