Microsoft Flow - Get executing user

Deleted
Not applicable

Hi,

 

We are trying to use Microsoft Flow for different scenarios - and we came across the need to get "current user" - meaning the user, who starts the flow manually - and not the user, who published the flow.

 

We do have an action called "Office 365-users - Get current profile"-something, but it takes the user who published the flow...

 

Any help will be appreciated!

 

 

11 Replies

The user who starts a flow is not known to the flow service unless the trigger provides it.

 

You mention manually starting a trigger. Assuming that means a flow button, you can get the User email and User name properties from the "Manually Trigger a Flow" trigger. When displaying the dynamic content, scroll to the bottom of the list for the trigger.

The specific case is when a user manually starts a flow tied to a SharePoint List Item. But as you said, the options lies in the trigger itself. The Flow buttons, approval and others due offer the executing user, but SharePoint OnSelectedItem triggers appearently doesn't.

Any idea to work around it?

The SharePoint item triggers provide the Created By and Modified By properties. 

Hi Poul,

 

Well - that does reflect who originally created or modified the ListItem (or document) - not the user, who selects a Listitem or document in SharePoint and choosing a flow to start manually, like this:

image.png

Hi, did you ever solve this? Thanks
Hi Matthew. No, haven't looked into it lately.

I'm also having this issue - Has anybody found a workaround?

You are supposed to now be able to run a flow in context of the user, least I thought it was live by now. Currently looking around to see if I can find it.

Hi Christopher - Hopefully this will save you the time!

 

Flow does run based upon the executing user rather than the person who produced the flow.

 

I found that my issue was due to a step earlier In the flow where the list item that triggered the flow is moved to a different location. By executing this step, I became the "Created by" user, which was my variable used to direct the flow through an approval.

 

I did feel silly when I worked it out!


Thanks for looking though

Hi Dave!

 

While this issue isn't identical to the one I am experiencing, it is the closest occurrence I have found so far. I am working on a document approval Flow that triggers when a file is created in a folder. The next step is Get My Profile (v2) in order to associate the document being reviewed with its author. This way, our manager can know for whom the document is being approved. So far, this flow always associates the user who originally created the flow with the document needing approval, rather than the user triggering the flow by placing a document in the specified folder. 

 

Are there any workarounds for this?

 

Much appreciated!

- A

@Anna DeKoning 

 

For getting the person who caused the flow to run based on a ShPt list NewItem trigger, use the dynamic property "Created By Email" to determine who the creator of the document is.  If you need to get that user's name, use their email as input for the Office 365 connector's "Get User Profile (v2)" function.  See ScottShearer's answer with screenshots here: https://powerusers.microsoft.com/t5/Building-Flows/Get-executing-user-in-Flow/td-p/135386