Notify users in Power Apps when a flow has run successfully

Are you using Power Apps triggered flows when creating Canvas Apps? In this post we’re going to look at how you can trigger a notification back to your user to let them know that a flow has run successfully. For example, we might have… READ MORE [https://lewisdoes.dev/blog/notify-users-of-succes
Notify users in Power Apps when a flow has run successfully
exc-62bc4ad291c10e049cc4a26b
In: Low Code Lewis Content 🚀

Are you using Power Apps triggered flows when creating Canvas Apps? In this post we’re going to look at how you can trigger a notification back to your user to let them know that a flow has run successfully. For example, we might have a function in our app to send an email, we’re going to add capability for our app to tell us that our email has sent successfully.

Creating our Power Apps flow

So here I have a Power Apps based flow which will trigger from within a Power Apps application. I am using the PowerApps trigger here to be able to utilise this flow from within my Canavs app.

I will add the flow steps relevant to my business requirement, in this example I am taking some data and putting it into a HTML table which I then put into a PDF file with some additional content and formatting.

At the end of my flow, this is where I need to add the steps that will send some data back to my Power Apps application.

Here I am taking the last step of the flow, or you could use a scope to implement better error handling, and I am then adding the ‘Respond to a PowerApp or flow’ step below this step. You will notice I have added two of these steps as parallel branches.

One of these steps will be for a successful flow run where the previous steps have run successfully, and the other will be if a previous step hasn’t run successfully.

Screenshot of a Power Automate, Power Apps triggered flow

Configure run after

You might be wondering how we tell Power Automate which of the flow steps to run. To do this, we need to configure ‘run after’ on each of these flow steps. We will configure one where the previous step was successful, and the other where it wasnt.

Simply click on the elipses on the flow step you want to configure and select configure run after. Then select the first check box for the step you want to tell your app that the flow was successful.

Then mirror the same on the other parallel step but choose the bottom 3 checkboxes.

Then on each of your respond to an app steps, create an output variable of type text, and with the one with only ‘is successful’ selected for configure run after, assign the value true and for the other assign the value false.

Now we need to do some work in our Power Apps application!

Configuring our flow in Power Apps

So in my Canvas app, I’m going to trigger the flow I’ve created when I select a button. So in this case I need to select the OnSelect property of the button I want to click to make my flow run, then I need to add some syntax to the formulas bar to get my flow to work.

First I need to add my flow into my app, so I’m going to select ‘Action’ in the command strip and select Power Automate, then I’m going to make sure my button is selected and select my flow. Now you will notice your flow has been added to the OnSelect property of your button, but we still have some formula to write.

Screenshot of the OnSelect property of my flow trigger button within my Canvas app

So, you’ll notice the syntax here is a bit different to just running a flow normally when we want to return data to our application. Here we want to provide the flow with inputs and outputs if we have both in our flow, and in my case I do! I need to provide some inputs the flow needs for a send an email step and then I need to tell Power Automate the action I want to take based on the output it provides.

So I’m going to put my normal syntax for running the flow without output inside an IF statement. Here is the syntax for if my flow didn’t have outputs. Note that the properties for input I have provided here are based on my flow and yours will likely be different, if you have any at all!

'FLOWNAME'.Run(User().Email,User().FullName)

Now for my flow that is going to provide an output, I simply want to put this in an IF statement where I follow this type of logic:

If my flow runs and the output property is equal to such a value, then do this, otherwise do this. To translate this into some plain english!…

If my flow runs and the success output property returns ‘true’, then I’m going to do an action which will be notifying my users that the flow ran successfully, but otherwise / if this is not the case, I’m going to notify my users that the flow was unsuccessful and they should check the result, and then contact their system administrator or IT.

The syntax to do this is:

If('FLOWNAME'.Run(User().Email,User().FullName).success="true",Notify("Notification Text Here for success",Success,10000),Notify("Notification text here for failure",Error,10000)

Remember my input properties within the brackets for my flow run are based on my flow’s business requirements, and yours will likely be different, so you need to change these.

I hope this helps, and you find that your users experience when engaging with your app is better through you communicating to them more when they make actions in your application!

Written by
Lewis Baybutt
Microsoft Business Applications MVP • Power Platform Consultant • Blogger • Community Contributor • #CommunityRocks • #SharingIsCaring
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to LewisDoesDev.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.