cancel
Showing results for 
Search instead for 
Did you mean: 
JonL

"Get Manager" For SharePoint Document Library Approvals

Hey Everyone,

Recently people have been coming to me with a common issue. They're stoked that SharePoint Document libraries are now supported in approvals, but they notice that when triggering off "when a file is created" that you arent able to expose the "get manager" action  in O365 to be able to send approval to the document creators manager dynamically.

 

I went to the team with this dilemma and thanks to @merwan - he showed me this wonderful little workaround that i now want to share with you.

First, lets set up a couple of things ahead of time.

 

This tutorial assumes you have a SharePoint Document library, and for ease of use, its named "Documents"

Next, it also assumes you use O365 in your environment. If you dont have O365, this tutorial wont be as relevant for you.

Ok so first things first, 

 

1. Head to https://flow.microsoft.com and login

2. Click on My Flows

3. Click on "+ Create from blank"

4. Add an action -> Select SharePoint -> "When an existing item is modified" -> enter your SharePoint url and then where it asks you to choose your list.. Manually type "Documents" (or whatever your Document library is named"

blog1.PNG

5. Add an action -> O365 -> Get Manager -> Open the dynamic content picker and use the SharePoint content piece "CreatedBy Email" this tells the O365 service to look up the manager of the person who created the document in the library. We will use this for the approval in a moment.

blog2.PNG

6. Next, Add a condition. (This is where the hackyness of this tutorial comes in. We are going to trick Flow into allowing us to see newly created items, and also acquire the manager of the creator, a function we couldnt achieve logically with the actions and triggers we were provided) and Make the condition read "Modfied" is equal to "Created"

blog3.PNG

7. In the IF YES column, add the "Approvals" Service and choose -> Start an approval.

8. Set all of your fields as desired in the approval email, the one important field being where it says "Assigned to" make sure andpass the "Email" dynamic content piece from O365 which represents the creators manager.

blog4.PNG

9. And voila! Thats all there is to it. 

 

Now obviously, this flow isnt finished. It needs some additional actions under the approval as far as sending email to notify the user of approval or rejection, or maybe a push notification or maybe the Flow copies the file once approved to a seperate location.

 

How would you finish this flow? What steps should i add next?

 

Let me know if you guys have any questions!

 

- Jon L

Senior PM- Flow Team

@PNWAdventureGuy

 

Comments

I'm not sure I understand. When I create a flow with the "when a new item is created" trigger, I am able to add a "get manager" action. What am I not understanding about about the item created vs modified triggers that would impact the use of the get manager action?

Jon, We are in a situation were we do not use the same Email as UPN. I find the Approval flow cannot locate the users manager when email does not match UPN. I have raised issue on the forums but got no good response. Any way to surface UPN instead of email in the dynamic created by content?

@Mike2500 Thats correct - "Create item" refers to creating a list item - The purpose of this blog is a workaround for this same "Get Manager" action, which isnt exposed by default when tryign to use "When a new file is created" for Flowing certain actions off of Document Libraries

@JonL, understood, but in step 4, instead of using "When an existing item is modified", you could have just used  "When an item is created", which means you could have avoided the "hacky" step 6. Either trigger is based on the list item, and should have access to the metadata fields that the file triggers lack.

 

@Mike2500 - Ahhhh got it. At the time of writing this, that fix hadnt been deployed yet. Glad to see it rolling out now. Ill erase this post in a few weeks when the rollout is complete.

@JonL, could you clarify which fix is rolling out? Is what you're talking about perhaps related to this question I posted earlier today?

 

 

@MikeE the new SharePoint connector rolled out a week ago

 

We now return the

  • URL to the item
  • Name (file name for document libraries, item title for lists)
  • Folder path
  • File identifier

@JonL Any help with the issue I posted above Jon? Really I just want to make sure you guys realize/acknowledge out of the box approval flows fail for users that do not have the same UPN as Email address.

So, this missing functionality was entered as a User Voice item in June 2016. The SharePoint list item data for a document is fundamental to any user with SharePoint background. The fact that it is missing is unfathomable to them. Twice now I have seen Flow discarded because the connector does not offer this functionality without this work-around.

The User Voice item is here: https://powerusers.microsoft.com/t5/Flow-Ideas/SharePoint-Files-all-fields-not-just-a-few/idi-p/2882

About the Author
  • 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.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/