Run As context in CDS (Current Environment) Flow Trigger | Power Automate

In a CDS (Current Environment), you have to option to Run the Flow under a context of a certain user. And there are a few options from which you can select from – Process Owner, Record Owner & Triggering User

Here’s my Flow in which the trigger is the CDS (Current Environment) connector. Show advanced options and you’ll see that there’s a field call as Run As


Which has the following 3 Options as I mentioned above –

Let’s look at each one of these.

Scenario

To demonstrate Run As, my Flow is triggering on the Update of the Account record, an attribute in the CDS (Current Environment) connector called as RunAsSystemUserId provides the GUID of the System User used in the connector’s Run As field.

You can use triggerOutputs() function to get this GUID from the Trigger Outputs and use it to fetch the System User record. To see how triggerOutputs/triggerBody() works, check this post – Using triggerBody() / triggerOutput() to read CDS trigger metadata attributes in a Flow | Power Automate

Process Owner

As suggested, Flow Owner meaning the one who Owns the Flow

  1. If I select as Process Owner, no matter who triggers the Flow or who is the Owner of the record, the Run As user will be the one who Owns the Flow.


    The record could belong to one owner and the other owner might modify it as shown below –



    But the Flow will Run As the Owner of the Flow as suggested.




    Multiple Owners?
    In my test, I believe the one who created the Flow becomes the first Owner and hence, is what it appears in Run As

Record Owner

  1. Easily, the record Owner in Dynamics 365 is the Owner of the record, so no matter who triggered the Flow or who the Flow owner is, the Record Owner will be the Run As user.

  2. In this example, Priyesh Wagh is modifying the record Owner by Kuldeep Gupta, the Flow Run As will show as Kuldeep Gupta

Triggering User [Also Default]

  1. If the Run As is set to Triggering User, whoever caused the Flow to Run is the Run As context user.


    Let’s say Kuldeep Gupta is a user is modifying a record Owned by SYSTEM, the Run As user is Kuldeep Gupta.




  2. Now, if there’s no Run As selected or even if there are multiple Owners to the same Flow, the one who causes the Flow to run, is the context user of the Flow.


    Let’s say Priyesh Wagh modified this record owned by SYSTEM, the Flow will Run As Priyesh Wagh


Hope this helps!!

Here are some more Power Automate related posts you might want to look at –

  1. Task Completion reminder using Flow Bot in Microsoft Teams | Power Automate
  2. Call HTTP Request from a Canvas Power App using Flow and get back Response | Power Automate
  3. Send a Power App Push Notification using Flow to open a record in Canvas App | Power Automate
  4. Accept HTTP Requests in a Flow and send Response back | Power Automate
  5. Terminate a Flow with Failed/Cancelled status | Power Automate
  6. ChildFlowUnsupportedForInvokerConnections error while using Child Flows [SOLVED] | Power Automate
  7. BPF Flow Step as a Trigger in CDS (Current Environment) connector | Power Automate
  8. Pause a Flow using Delay and Delay Until | Power Automate
  9. Generate Dynamics 365 record link in a Flow using CDS connector | Power Automate
  10. Setting Retry Policy for an HTTP request in a Flow | Power Automate
  11. Text Functions in a Flow | Power Automate
  12. Using Parse JSON to read individual List Records in Flow|Power Automate

Thank you!!

2 thoughts on “Run As context in CDS (Current Environment) Flow Trigger | Power Automate

  1. Are you sure the “Process Owner” option uses the Flow Owner and not the user account used on the connection? I tried a sample Flow using Run-As “Process Owner”. Owner was “A” and Connection User was “B”. When I ran the Flow the RunAsSystemUserId was not that of the Flow Owner but the Connection User. Can you confirm please?

    Like

    • I tried using 2 users and kept them different. I didn’t pay attention to Connection User (I assume you mean CDS connection user).
      Not sure if CDS connection user would supersede the Flow Owner. Maybe I’ll try to give it another shot.

      Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.