cancel
Showing results for 
Search instead for 
Did you mean: 

Get Approvers Dynamically from SharePoint List

I use Approvals in Flow a lot to automate approval processes for my clients.  I recently had one client request that the designated approvers be pulled from a SharePoint list rather than being added in the Flow itself.  This would enable an end user to update the approvers rather than having to submit a change request for someone in IT to update the Flow.  

 

Setting Up the SharePoint List

 

The first step is to set up the SharePoint list to hold the approvers.  Use the "Custom List" template and create an additional column called "Approvers" which is a Person or Group Field Type.  Make sure to select the option to "Allow Multiple Persons" when setting up the field if you need multiple approvers.  

 

Configuring the Flow

 

Now that we have our approvers list we need to configure the Flow.  I used the "When a New Item is Added, start Approval" Flow template for my SharePoint list that I need the approval process on.  After the "When a New Item is Added" trigger, add an "Initialize Variable" Action.  Call this variable "Approvers" and set it to a string data type.

ApprvVariable.png

  

Next, we need to add a "SharePoint - Get Item" Action.  Point this to the URL and list name of the SharePoint approvals list we created earlier.  This action requires the ID of the item that you want to get from SharePoint so you'll need to put in the ID of the corresponding approver item.

ApprGetItems.png

  

 

Now that we have our approvers item, we need to insert a "Set Variable" action and set the Approvers variable we created earlier to the "Approvers Email" field from our Get Item action.  Once we do that, Flow will automatically wrap the set variable action inside an Apply to Each function because the Approvers field in the list is set to allow multiple.  The important thing to note here is we need to make sure to put a semicolon after the Approver Email field in the Set Variable action.  If you don't do that then the multiple approvers will be strung together and the Flow will error out.  The semicolon seperates the multiple emails and ensures they are registered properly.  

ApprvApplyEach.png

 

 

The last step is to set the Assigned To property in the Approval action to the Approvers variable we just set.  That's all you have to do!  Now an end user can update the approvers in SharePoint without ever having to touch the Flow!  

Comments

Hi April,

I do the exact same step but yet this is not working for me. 😞 Can you help me?
It only works when there is only 1 Person in my sharepoint list. (Approver)

What I want to achieve is for "Multiple Approvers"
Note: I already enabled  the Allow multiple selections in my sharepoint list ( Column )



Sharepoint Multiple.PNG

I also make sure that I add the semicolon (;) in setting the variable 

Variable.PNG
Kindest regards,

Mark Joseph Lagan

Hey Mark.  When you say it doesn't work with multiple approvers....do you get any kind of error message you could share?

Hi - I know this thread is a bit old - but very useful. I had issues with the flow above as it would only send approval to the last person in my list.  After searching similar posts, I narrowed it down to needing to add "Append to string variable " rather than "Set Variable" inside the "apply to each"

Hi there

 

I have a library (not a list) which has a column (People picker) and every time a document is uploaded the user specify the approver. The field is single, Display email address (seeing that it is integrated into AD). Why can't I use this column as dynamic content in the "Assigned to" for the workflow 'when a file is added, approve file using SharePoint Content Approval' I get the error below.

(currently only accepts email change within flow - surely this is wrong)

Is there any hope or another workflow I can use.

Flow issues3.JPG

 

 

Hi lallison - maybe try wrapping the email into a string variable using the mehod above and then pass this to the approval step?

Hi

 

The variable she is using is for a different template and also it works with a list, I have tried to replicate but still having issues because it seems that the assigned to field must be completed and only with email address although it allows for Dynamic content.

Just sooo weird that they would not be able to accommodate for this - sure I am missing something. Reviewed all similar issues but no results. Been trying for a few days now to get his right, now I miss designer.

 

Any other ideas - please I will appreciate.

Sorry if I misunderstand.

 

So have you tried:

- Initialise variable (string)

- Get File MetaData

- Append to string variable (enter person from your doc library) followed by ";"

- Start an approval (add the string variable as the approver list)

 

...or are you saying that the get file metadata does not return the email field at all? Could you add some more screenshots of the flow expanded?

 

Hi,

 

Yes I did, I replicated again as follows,

 

Step and Issue 1: 

 

I have a library with a lookup to a Approvers list, the approver list has a Person/group column (which cannot be used for lookups) and had to create a text column in the list to lookup from, and then populate into a text column.

Please confirm if this is correct

 

Thank you

Meet Our Blog Authors
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Cambridge UK Power Platform User Group Leader, Technical evangelist and speaker. Always says yes to coffee! #LetsGetCoffee
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor