cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AneeqaPervaiz
Helper II
Helper II

Troubleshooting "Run-As' Option in Power automate

Hello, 

I have a flow which triggers when a record is created. then creates a folder in SharePoint, and manages permissions. Atleast this part when I test it through the admin account. Then I log into test account (with limited permissions) - and create a record. Sure enough, the flow fires but it fails to grab the correct ID of 'Created By'. I have set it to run as 'Record Owner', even used invoker's connection in the following steps. It still runs as the process owner. I need it to grab the correct ID, because in the later steps I am granting access to Sharepoint folder and want to use the dynamic field for a recipient. 
Is there any additional step that needs to be done to ensure the flow runs as record owner and not the admin?

@Jcook @Pstork1 @abm 

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User III
Dual Super User III

First, if you want to get the Created By user I think you need to run it as 'Triggering user' not 'Record Owner'.  If you run as 'Record Owner' then I think that is who you get as the Created By.

 

Second, The created By value that you will get is an ID number.  You then need to take that and look it up in the Users entity to retrieve the domain account.  That will be the SharePoint login account.

 

Like this

image.png

But running as Triggered user I'm not sure you'll be able to read the user Name from the User's entity.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

2 REPLIES 2
Pstork1
Dual Super User III
Dual Super User III

First, if you want to get the Created By user I think you need to run it as 'Triggering user' not 'Record Owner'.  If you run as 'Record Owner' then I think that is who you get as the Created By.

 

Second, The created By value that you will get is an ID number.  You then need to take that and look it up in the Users entity to retrieve the domain account.  That will be the SharePoint login account.

 

Like this

image.png

But running as Triggered user I'm not sure you'll be able to read the user Name from the User's entity.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Thank you @Pstork1 

 

I used the get record action step to get the created by value and used it in the 'Granting access to SharePoint Item'. I used the output as a recipient and it works. 
It still runs as the admin despite setting it to triggering user - but my aim was to set permissions which I have used the get record step for. Thanks for the idea. 

 

 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (20,521)