PowerApps call Power Automate flow with parameters

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone welcome to the first video for flow quick tips wherein we will focus on some quick tips around flows now in this first tip we will focus on calling flow from powerapps now in powerapps when you would like to call a flow we add a button and on select action of this button we can go ahead and call power automate another way to do this is just select the button go to the action tab and click on power automate now the moment you select this it will list out all the flows that are available that have a trigger associated with power apps because you're calling flow from power apps important to note you will only see those flows listed here based on the environment you're creating the app in so your app and your flows have to be in the same environment now in this exercise i'm just going to go ahead and simply create a new flow now the moment i do this this will take me to flow and it will list out all the flow templates that are available based on the powerapps trigger that you can choose from and the first tip here is that use templates wherever you can because templates are a great way to enable reusability purely because the scenario that you're trying to execute might already be available as a template all you have to do is literally select your scenario based on the templates that have been provided here and go ahead and configure it or customize it based on your needs in this scenario i will just go ahead and pick the powerapps button trigger and this will go ahead and create the flow for me here's the next step the moment you create the flow first thing is go and rename this flow that is because whatever you name this flow will be the name of the function when powerapps will call flow so in this case i'm just going to go ahead and call this flow tips and now i have powered apps as the trigger and i can go ahead and start configuring my flow i'm going to take a very simple use case here i have a sharepoint list and in my sharepoint list i'm tracking assets it has an asset name a date and the number of assets that i need now in flow if i need the parameters to come in from powerapps into flow there is no option out here for you to go ahead and ask for those parameters what you have to do is you have to ask for those parameters there are different ways in which you can ask for those parameters first thing is and this is what i typically see is we create variables right so we can go and initialize a variable and i'm going to give this a name variable name i will pick type as string and this is the name of the asset that's going to be passed i'm going to leave it empty now if you need the value to come from flow to powerapps you have to go to dynamic content and select this option called ask in powerapps now the moment i pick ask in powerapps this will go ahead and create a parameter for me that has to be passed from powerapps to flow when i'm calling this flow it has gone ahead and created this dynamic content variable value for me right here and this is called initialize variable underscore value now this name is something that cannot be customized once you have created it and the way it creates this name is it depends upon the name of your action now note here the name of my action is initialize variable here's another tip make sure that you go ahead and name your variables correctly because that's going to be the name of the parameters that's going to be passed from powerapps to flow so in this case it's the asset name so i'm just going to call this asset name now if i just remove this and if i go ahead and click on ask in powerapps notice it has the correct naming standards here for me which says asset name underscore value which clearly shows that you need to pass the name of the asset from powerapps to flow next thing what i want you to understand is if i click this right here if you notice i still have the previous variable and here's another tip the way you can remove this variable now is you have to go to powerapps which is your trigger delete the trigger because the trigger has that variable associated click the powerapps trigger action again and this time once you do that it will clean out all the variables go back and ask again now please note many a times i have noticed this that we just click on ask click on ask every time you click on ask it is going ahead and creating a variable so here's another tip do not do that click on ask in powerapps only when you're sure you need a value coming from powerapps to flow if you keep clicking you're going to keep adding more variables where are these variables going where is the definition for these variables if you go to peak code in the trigger action which is powerapps you will note that these are all your variables that are just stacking up out here and the only way to get rid of them then is to delete this trigger action which will clear all the variables go back pick the trigger and once again start asking in powerapps i will go ahead and add another variable i'm creating a variable called for the asset count i'm going to pick integer as the data type and i'm going to rename this and call it asset account remember naming standards and now if i say ask in powerapps ask in powerapps it will create this variable for me so now i have two variables okay now one thing i wanted to observe is if you look at my sharepoint list i have the date column here there is no type called as date now yes you can create a string and pass it a string but then you would you would have to transform the string and make sure that the string is of type date before you pass it to your data source so be aware of those things you can also pass json objects basically objects of collections or galleries in powerapps to flow i have a video that i've done earlier which basically showcases this when i'm passing files as well as metadata from powerapps to flow and passing all that data over as a json object i'll put the link in the description of this video so do check it out now the next step is let's say i want to go ahead and create an item in my sharepoint list of assets so i'm going to pick my sharepoint site i'm going to pick my sharepoint name which is assets and now all i have to do is specify the values so the title i can directly go and use the asset name underscore value the count will be asset count underscore value of course nothing stops me from clicking here and directly asking in powerapps as well so i don't need the variables i can directly go and say okay for the date ask it in powerapps now when i do this just to show you this if i go back to peak code in the trigger you will notice that the date is also coming as a string the only thing is it is formatted as a date it needs to be in a date format and sharepoint expects a particular format that i will show you right now now so i'm going to go and save this flow once the flow is saved heading back to powerapps you will note that that flow should show up immediately now i'm gonna go ahead and select that flow the flow is getting called right here and click of this button it's called flow tips dot run and i'm getting an error and the error is because i need to pass these values over to flow it's asking me for the name of the asset in this scenario i already have created a form so i'm going to pass the name of my asset directly from my form so here's the asset.text that's asking me for the count i'm just going to pass the count and it's asking me for the date now so i'm going to play this app and i'm going to start entering some data so the asset that i'm trying to order right now is a lenovo lenovo laptop and i need one of these and i need it by the 9th of september i'm going to go ahead and call the flow now when you click on call flow this will go ahead and trigger the flow but in my scenario right here observe that i'm getting an error and the error that i'm getting right here is it's telling me that the format is not matching the format that is expected now notice the date that's going across here is 9 9 20 20 does not validate against format date please note when you are defining your variables in power apps all these variables have a type associated with it also they have a format associated with it in this scenario i have something known as asset name which is a string i'm passing a string async covered asset count has to be an integer i'm passing an integer value it's asking me for the date now the date is of type string but it's expecting it in a peculiar format now the format in this case because i'm dealing with sharepoint so what i need to do is go ahead and here's another tip format this to your month day so this is the format that sharepoint expects so i'm going to go ahead and call the flow again and this time if you notice i do not get any error and if i head back to the flow you see the flow has ran five seconds ago and if i select this you will note that the flow has been called and all the values that i passed the date the title and the count have been passed over from power dash to flow and if i head over to my sharepoint list i see that value right here let's assume we have another variable that i create right here and once again click on ask in powerapps now note i have added another variable there could be various scenarios where you add more attributes or maybe you delete an existing variable or maybe change its data type once you make the changes in flow go ahead and save the flow also ensure that there are no errors in flow once your flow is safe now if i head back to powerapps please note that if i look at that function again it will still show me the previous definition of the flow now if i go ahead and call the flow i will receive an error and the error says that the request did not match the schema definition of my flow now what has happened here is my flow has changed but the definition and powerapps is still old now how do i go about changing this now if you go to data on the left hand side you will notice that in your app you will get this association of the flow and that's the association right here now what i want you to do is actually remove this association so i went ahead and removed the association of my flow in my app so i'm going to go ahead and do that now before doing that make sure that you copy whatever code you have on that button the reason is because the moment you reassociate all the code that you have will be cleaned up you won't get that back so make sure you have that so i'm going to copy this so i don't lose it i will go to power automate and i'm going to click on that button again so i'm reassociating that flow once again with my app now the moment i do this notice the association comes back right here and this time it again tells me that hey we're going to run that flow right here and this time it's asking me for four values now note what happened all the code that i had on select is gone now whatever i had copied i can paste it back so i don't lose the earlier code and of course i need to pass additional attributes here maybe the asset description so i'm going to say sample description because it needs to be a string and now i can go ahead and call my flow directly from my app so these were some quick tips on calling flows from powerapps i hope this was useful i will see you guys again in the next flow quick tips video thank you so much for watching do like comment and subscribe to my youtube channel
Info
Channel: Reza Dorrani
Views: 116,780
Rating: undefined out of 5
Keywords: call power automate from powerapps, powerapps call flow, powerapps call flow with parameter, powerapps call power automate, powerapps trigger flow, powerapps and flow integration with sharepoint, powerapps call flow from button, powerapps trigger flow from button, powerapps trigger flow on button click, call flow from powerapps, powerapps trigger flow with parameters, powerapps flow tutorial, powerapps flow sharepoint list, powerapps flow parameters, powerapps flow not showing up
Id: emAhLzVG9bM
Channel Id: undefined
Length: 11min 20sec (680 seconds)
Published: Mon Sep 07 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.