Using triggerOutputs to send an email to the person who triggered a flow

Nothing can stay hidden from the Power of Power Automate. Not even the email of the person who triggers the flow.

In this post, I will shortly explain how any app user can trigger an instant cloud flow on the background and receive what they see on their Power App screen via email.

We will start by adding a simple table and a simple download button.

Then we go to Power Automate and create an instant cloud flow with Power Apps trigger:

Here is the standard part of the flow:

  1. Get the items from the table we are visualizing

  2. Create a csv table out of the data

  3. Create a file with the output of the table. To the name of my file, I'm adding the utcNow() function, so that you know which day the export was made. Inside the () you can add utcNow('dd-MM-yyyy-hh-mm-ss') if there are many people who are going to download, so that your files do not get overwritten.

  4. Then we are going to get that file's content.

The last pat is the most interesting one. Once you run the flow, you can see that the trigger provides us with lots of data, which is not visible amongst the dynamic fields.

For the next step - email recipient, we will need the email of the user who triggered the flow. This data is in the headers of the trigger and the field is called x-ms-user-email.

Our next step is adding the Send an email action, where for the recipient the following formula should be used:

triggerOutputs()['headers']['x-ms-user-email']

Now after saving the flow and a couple of minutes, it should be visible in Power Apps.

Click on your flow and add it

All what is left is adding the .Run() function to the On Select property of the "download" - nameoftheflow.Run();