Connecting Power Apps to Power Automate - How it Works and What to Expect

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
have you ever been building a canvas app and you've wondered how can i connect it to power automate so that i can call a flow that's going to do something else we're going to walk you through some options for doing that today how to send data in how to get data back out so this is one of those things that oftentimes you don't really think about until you get stuck so you might be building a canvas app and you want to send a file somewhere or maybe generate a file from input from a user in your app or maybe even iterate through some rows in a data set to take some action on those rows or something like that the reality is that canvas apps natively doesn't handle those types of things very well and there are numerous examples out there on the internet of ways that you can enhance your canvas app or your power app by simply calling a flow to do those that work for you so in this video we're going to walk through what it means to connect to power automate from your canvas app but then also how to pass data in a couple different methods for that and how to get data back out all right so just a quick reminder before we jump in if you like this content smash the like button and if you want to see more of it make sure that you subscribe [Music] all right so let's get started we're going to first add an automation screen to our canvas app here so i'm going to come over into my home menu we're going to add a new screen like so i'm going to rename this to my automate screen all right and before we get started i'm just going to go ahead and make this screen look a little bit prettier we're going to add our header and our menu so we'll find it from our components header and a menu okay so now that we're ready to connect this canvas app to power automate or to a power automate flow uh we're our first way of doing that is we're just going to go ahead and add a button to the screen so it's as if a user wanted to click a button and make something happen in flow or in power automate so we're going to go ahead and add a button to our screen and we're going to change our text for that button to start flow and i'm going to go over here and also adjust some of my colors so we'll go find our fill all right so then the easiest way to connect this button to a flow is to simply select the button look for your on select property of that button so that's basically where all of your action is going to take place so now that we've got that selected you can come up here to your action menu and you can simply click on the power automate button and this will open basically a little data connection dialog if you will or panel and from here you can choose to create a new flow now what this is going to do is this is actually going to open up powerautomate in another browser window and there's going to be a whole bunch of templates template flows that you can draw from that all are started from a click of a power apps button in this particular case i'm going to go ahead and just create a flow myself so we're going to just go to create and we're going to choose instant cloudflow and we're going to give this a name and we'll go ahead and name it after our button and again we're choosing powerapps as our trigger so go ahead and create that and so now i have my flow that's going to be connected to my button now the next thing we want to do here is we want to actually have this flow do something so we're going to go ahead and we're going to create a new step and in this particular case we'll just create an approval it's a pretty common scenario so we're going to go ahead and create an approval we'll send it to myself okay so there we have a simple approval we'll go ahead and save this flow and you'll know everything is good if you don't see any little red marks up here in the flowchecker and if you get that green notification that tells you it was saved successfully so now we can flip back to our power app and you'll notice that in that data connection panel now we have a flow that's showing up and that's the flow that we just created so all we have to do to connect it is simply click on it and it will add it as a connection to our powerapp or our canvas app and it will also basically begin to wire it up in the onselect of that button so in this particular case we can simply finish off that wiring it up and now we're good to go so if we play this application we can simply come in here and we can click start flow and it will basically create an approval for us and so now if we go monitor our email or our approval items we should see that email come in so let's just give this a second and wait for that approval okay so it looks like we have a new email at 11 15 a.m says please approve this request and that's our approval that we just sent with that flow so just like that we've made it so that you can send an approval to someone through the canvas app just on a button click so we've connected powerapps to powerautomate all right so now that we have our basic button wired up to connect to a power automate flow the next question is what if i actually want parameters so it's one thing to like invoke a flow but what if i actually need to send some data to that flow so let me first show you a simple way to do that using the flow that we've already created so let's flip back to that flow and power automate and one of the things that you'll notice when you're filling out these fields for example so in the title field we just put some text in there but if you pay attention to this dynamic content dialog you'll notice that there's an option here for ask in power apps so if we get rid of the title that we hard coded there and simply say ask in powerapps this will add a little powerapps variable if you will that comes from the trigger body of that powerapps button click um and in this case it's automatically naming it it's calling it create an approval underscore title so we'll just go with that so now we're going to go ahead and save this all right so no red marks on our flowchecker and we've tells us that it's saved successfully now we can flip back to our power app and figure out how to pass that in so the first thing we're going to do is i'm going to add a text input to this screen so that somebody can actually provide a title so we'll add that we'll add a label as well so that we know what it is all right and so now our default value for this we'll empty that out so that the user can fill it in all right now the next thing that we need to do is we need to actually reconnect the button so one of the things like right now this is not passing anything in it's just calling run we need to be able to pass in a value from this text input the easiest way to do this is to simply go to your data connections and remove the start flow button connection that's already there so you'll notice that this is here and this is the original version that we created that doesn't know anything about the parameters um so it's easiest to simply remove this and now of course we have an error on our button on select and so we need to rewire this up to the updated version so we're going to go ahead and click our power automate action again and then we can select that start flow button that same flow that we had before and it will then re-add that data connection and also begin to wire up our onselect now this time you'll notice in this on select in the run function that we have a parameter create an approval title is already set there for so it's giving us some intellisense that we need to actually provide something whereas before we didn't have that so we're going to go ahead and provide the value from our text input field so we should have a text input somewhere there it is dot text all right and so now we're actually passing in a value from that field so let's go ahead and test this out this time we're going to play the application and i'm going to put a different title in here so let's say pretty please approve this request and now we're going to go ahead and click our start flow button and so that should have sent another basically trigger to that flow that will ultimately result in another approval for us so let's go ahead and flip over to our email and indeed we have a new approval waiting for us pretty please approve this request and you can see in our email we can choose to approve or reject it here just a second ago we learned how to use the ask in powerapps option dynamic option to be able to request parameters from our powerapp but another thing you should be aware of is that there's another type of powerapps trigger that changes the way that we think about our input parameters a little bit and that's called the powerapps v2 trigger so to use that i'm going to go ahead and add another button to this so that we have both types of implementations on this screen so we're going to go ahead and add this button we'll change our text and we'll call this start flow v2 make our button a little bit more prominent and find our fill property there we go okay so now this time we're going to go right into flow so let's go over to power automate i'm going to go ahead and jump right out of this existing flow and we're going to create a new flow from scratch we're going to choose instant cloudflow and we're going to call this startflowv2 so now in this particular case you'll if you go through this list you'll actually see that there is a powerapps and a powerapps v2 trigger option so we're going to choose the powerapps v2 option and the first thing you should notice right away about this is when you select that trigger you have an option right on the trigger to add inputs so first we'll add an input for our and we'll have it be a text input and this will be our request title so rather than say input we'll say request title we'll add another input since we're dealing with approvals we'll make it a boolean and we're going to call it allow reassign and we can apply that to our approval that we're going to create so the main thing that you should note when you're doing it this way is that we can be much more explicit or specific and descriptive with our parameter names so we don't have to rely on power automate to automatically generate those names so in the scenario that you're thinking ahead a little bit and you're thinking about what the extra functionality is that you're going to do with that flow and you're building that first you can be more prescriptive with it and then the names are simply more meaningful for the developer who's actually building the power app so that's a that's a pretty big benefit so we'll go ahead and create a new step here and in this case we're going to again use the approvals and we'll go ahead and create an approval choose our approval type now in this case you'll notice that we do not have the option to ask in powerapps so because we're using a different style trigger you don't have that option but fortunately we can select our very nicely named parameters so in this case we're going to use the request title here and then in our advanced options of the approval there should be an option for enabling reassignment and so here we're going to do a custom value and from our dynamic content we've got a boolean value already matched up for us for our allow reassign so we're going to go ahead and do that so now we're going to save this flow oh and i always forget one thing or another gotta send it to myself there we go so now no red marks on our flowchecker we'll go ahead and save it and we have a new flow okay so now let's flip back to our canvas app and on our start flow v2 button we're ready to wire this up so we can actually go to our onselect property and we're going to select power automate from our action menu and notice that our new flow is automatically showing up so it went out and looked and it found that connection to it so we're going to go ahead and select that one and once it is added to our app we'll get that same uh beginning of the wire up if you will in the on select and we'll see that we have a couple parameters a text parameter and a boolean parameter and we're going to go ahead and provide our request title it's going to come from our text input and the next one that we care about is allow reassign and we're going to go ahead and set this to false all right so now we can actually go and test this button so let's go ahead and play and we'll start flow v2 and so i'll get another one that says pretty please approve this request and in this case i should not be able to reassign it so we'll just wait for that email to come there it is all right so there's my option let's actually go take a look at this approval and verify that i cannot reassign it so a quick way to get to the approvals is you can do that in power automate and look through your action items and you'll see a whole bunch of approvals if you've been testing this this is that latest one that we received so we can go ahead and select that and you'll notice there's no option here to reassign it if we actually go look at the previous one just to verify we have an option to reassign there so let's again verify this latest one that that is not an option so there it is grayed out all right so now that we know a couple different ways that we can pass data into a power automate flow the next thing we really ought to be concerned with is what if i need to get data back from that flow and it's actually really quite easy so to do this what we're going to do is we're going to jump back to that most recent flow that we were working on and where we're creating approval i'm going to go ahead and create a new step where we're going to wait for that same approval so that we can get the results so we're going to wait for an approval we'll wire this up to the id of the approval that was created all right and the next step that we want is we're going to actually return or respond to powerapps so if we look in our list here for respond we should have an option to respond to a power app or flow all right so in this case just like our trigger we have an option to add an output and so we can choose text output for as a simple example and we can provide response as the name of it and then we're going to actually provide the value to response so you could hard code something here but in this particular case what we really care about is the response that comes from the wait for an approval action so in this particular case i'm going to look for should be an outcome somewhere here that should be good enough for us actually let's see go ahead and do a search for it there we go all right so that'll actually give us the outcome of the approval and we'll plug that somewhere into our application so let's go ahead and save this flow all right now the next thing we need to do is jump back to our canvas app uh in this particular case we're gonna again click the same button but it's now gonna return a value for us and so we gotta figure out how to get that value and and what to do with it so the what to do with it i'm just going to go ahead and add a text label and in this particular case i am going to set the value of this label to a new variable that we're going to create called var response and of course i haven't created that variable yet so it doesn't know anything about it but to create that variable all we have to do is go into our onselect of our startflow v2 button and this basically this function this startflowv2.run returns a value or a collection of values or an object just like any other method call would in any normal programming language so we can do something like this we can say update context and we can simply set our var response to whatever this thing returns just like so now we could have also set a global variable or something like that and right now it's returning false because there's basically nothing that's like a default response so the next thing to do is go ahead and test this and approve that request so let's go ahead and click our play button and i'm going to click actually let's change this so that we have something a little bit different with a cherry on top we're going to go ahead and start flow v2 okay so now an interesting thing about this is we're actually creating an approval and then we're waiting for an approval so this button click didn't return immediately it's actually waiting on the response for that approval so we're going to quickly jump over here and we're going to find that approval and we're going to approve it all right so now that approval has been sent our flow should pick it up and if we jump back to our app we'll see that the response was true so that worked as we expected it now that scenario is completely contrived there is no normal real-world scenario where you would actually click a button send an approval and then wait on that so just make a special note of that if you're doing this type of connection and you're waiting on a response you want to make sure that you're getting that response back quickly and if you're doing approvals there are other ways to deal with once a response is finally available and what to do with it next all right that's it for our video on how to connect powerapps to powerautomate i hope you enjoyed the content if you have any questions feel free to post a comment below and as always you can join us for our office hours every month and if you're interested more of this type of content we have some more on our learning center on our website [Music] [Music] you
Info
Channel: Bulb Digital
Views: 38,915
Rating: undefined out of 5
Keywords: Call flow from powerapps, Flow from power apps, Power apps power automate, automation, call power automate from powerapps, microsoft power automate, microsoft power automate tutorial, power apps, power automate, power automate how to, power automate microsoft, power automate tutorial, powerapps, powerapps trigger flow, canvas app, data connection, flow, power automate flow, button action, data passing, data retrieval, automation screen, cloudflow, microsoft space
Id: -hDO9s1zCb0
Channel Id: undefined
Length: 19min 33sec (1173 seconds)
Published: Thu Apr 07 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.