Using Variables in Power Automate Desktop

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome back to my video series on robotic process automation with power automate desktop my name is devon knight i'm the president of training at pragmatic works where we teach all about the power platform including power automate and this is a little video that goes along with a series that i started to show you some of the basics of working with rpa now if you're interested in going deeper into power automate we certainly do have courses that go much more in depth than what we're going to be able to do in these this short youtube series you can find some more information about those courses below in the description this is actually the second video in a series on showing some end-to-end ways that you can work with power automate desktop so you'll also see below in the description i'll post a link to the previous video to this one that really gets the ground running with power automated desktop so in this example we're going to be picking up where we left off in video number one and in this video we're going to be starting to talk about how do we make our power automate desktop solution dynamic and so the way that we're going to be doing that is by creating variables with inside of our flows that we've created so we have this flow that you can see on my screen now that flow that we created is using a contoso invoicing application just to show you what that looks like in case you did not watch video number one this is our legacy application or contoso invoicing application and our goal is that we want to input in some new accounts without having to require a physical person a human being to type that information in and so we have a flow a power automate desktop flow that's designed to do that for us so just as a reminder of what we did in the last one if i were to run this flow right now if i hit run it's going to launch my contoso invoicing application and it's going to enter in an account into my uh invoicing application here and you can see that kind of happening in the background but what i'd like to do is what the kind of next steps is i want to make this dynamic and i want to make it where i can have both input variables and output variables so the idea of input variables is i want to pass n values into my flow and the idea of output variables is i want to extract values out of my application or out of my flow and so that's what we're going to learn about in today's video is both creating input and output variables now you'll find variables can be created up in the variables window in the top right so in the top right you'll see there's a variable section here and with inside the variables section you'll notice that there are two types of variables there are input and output variables right here and there are flow variables that are on the bottom now flow variables are ones that are created for you automatically with inside of your flow these are not ones that you're going to be able to do a bunch of modifications to uh you can't change the name of them in some cases but generally speaking the flow variables are ones that are just communicating and passing values back and forth within your flow and it's going often times these flow variables will be created automatically for you they're not something that you're going to be creating but you can interact with them we actually saw that in our first video where we used a flow variable the one you see on the screen here to close the application that we opened in the very beginning the other type of variable though here is input and output variables these are what i would consider and call user defined variables these are ones that you can create to either input values into your flow or extract values out of your flow and so through the course of this example we're going to create three input variables in one output variable we're going to show you how you can use them in action and then in a future video we'll actually show you how you can pass in values from something like a cloud flow into our desktop flow so first thing though what i'd like to do is i'm going to create a couple variables really a total of four variables three input one output so to create an input variable you'll select the little plus sign that you see right here and we'll go ahead and select that right above my head and we'll select input and when we do it's going to pop open this dialog box where we can enter in some information things like the name of the variable any kind of default value we might want and often times it is helpful to have a description for your variables in case someone is coming to work on your flow after you you'll want to make sure they are familiar with what the variables are doing so of course providing descriptions are always a good thing you may not see me do that in these videos because we're trying to make some very short videos here but it's always the best practice to add in descriptions describing what the variable is storing and what it's doing so in our example we're going to give the variable a new name and we're going to call this var in so it's a variable it's an input variable and we will call this one let's see what we have here we're going to call this one company name and i move this aside a little bit because i wanted to see the rest of my flow so i knew where i wanted to pass it into now you have a variable name and you also have an external name the difference between those is the variable name is what you're going to see with inside of your desktop flow whereas the external name is how it may appear in other applications like cloud flows so we're going to go ahead and rename our external name of our variable to the same thing and then we can provide a default value here so that way we have something to test with so default values are optional you don't have to have a default value but while i'm working with this variable or while i'm working with this solution i might want to pass in some default values so my default value for my company name may be pragmatic works okay and i'll hit create now we're going to go create another variable by going back up to the variables menu you can see the one we just created above my head here we're going to add in another variable by hitting the plus sign again and we're going to select input variable again and in this new variable we're going to call this var n and this one is going to be our contact name and by the way you'll notice there you cannot have spaces in the names of your variables so if you want to put underscores you can do that but there are no spaces allowed in the names of your variables so be aware of that all right then we're going to go ahead and give a default value uh on this one we'll call this one one of my colleagues i'll put mitchell pearson in here okay just so i have a different name than what's already hard coded with inside of my uh flow and then i'll hit create all right and then we're going to create one more input variable and one more output variable we're going to go up to the top here hit plus and select input and this final variable is going to be the email address so i'm going to go ahead and rename this one we'll call this var n and we'll call this contact email and i'll take that name and bring that down here into the external name they could be named differently but i'm going to leave them the same and then we'll give it a default value i'm going to plug in my email address here so people don't email mitchell i'm wondering about questions on this so i'm going to go ahead and put my person my my work email address in here feel free to email if you if you have questions all right so i'm going to go ahead and hit create and you'll see those three input variables are created uh we're going to come back to output variables in a moment but let's focus in on input variables so we have these three input variables and what i'd like to do is i want to map these three input variables and replace the hard-coded values that we see right here so what i'd like to do is i want to map in and pass in the company name and the contact name and the contact email address it looks like i got those a little switched up here should be more like that but i want to pass those in to my flow to be able to make it dynamic and change the values and make it where i can have a more dynamic solution so if we want to replace our hard-coded values with the values that are inside of my variables we're going to come over here where it has the action and we can either double click or you can select the three dot menu on the far right the more actions menu and we can select edit this is right above my head we'll select edit here and i can replace the hard-coded value that we see on the screen here with my variable so if i want to replace the hard-coded devin's donuts i can replace it with a variable right here and i can hit select variable and i can choose my company name variable right here called var in company name so i'm going to go ahead and select that double click on it and you'll want to get rid of the hard-coded value before you do this otherwise you'll have the hard-coded value and your variable both there at the same time but here i can see my variable value is the only option that i have here which is what i want and then i'll hit save now we're going to do this two more times i'm going to have another variable here underneath and i double clicked on it this time but i'm gonna have another variable here and i'm gonna replace the hard-coded devon knight with my variable which we can hit the select variable option again and we'll select uh contact name okay like so and then we're going to do one more here we're going to replace the d9.donuts.com we're going to replace that by double clicking on it and replace the hard-coded text back that out and we're going to replace it with a variable again so it's three times doing the same thing here that's why i did it a little fast because once you've seen it once you know how to do it we're just kind of doing the same thing a couple times here all right so we're gonna hit save and now you can see all three of those variables are now leveraged and used with inside of my solution so if i were to save this make sure we save our flow before we run it and if i run this flow it will now pass in my variable values that you see over here instead of what we had hardcoded in there so let's go ahead and run this again just so you can see that i'll take my hands off the mouse and keyboard so we know that it's actually doing it on its own we'll see the account information get entered in as pragmatic works with mitchell pearson and my email address so variables are working perfect those are input variables now let's talk about output variables now the output variable that i would like to have and let me show you the contoso invoicing app here again is i want to extract the con the account id right here so when we go to input in a new account i then want to output the account id to use somewhere else i want to log the account id somewhere else so if you want to extract information out of a application like this then that would be done through an output variable so how do we create an output variable we're going to go back up to the variables menu in the top right above my head and we're going to select the plus sign right here and we're going to add in an output variable and this output variable we're going to call and name it something that we can tell what it is we're going to call this var out this time because it's a variable that's an output variable and we're going to call this one account id and i'm going to copy that and bring that down here now you'll notice there is no default value for output variables because you're going to be passing something into it you don't need or you're going to extract something into it you don't need a default value here all right so i'm going to hit create and you'll now see those four variables created notice no default value on the output variable now how do i actually get a value out of my application and store it in that variable that's our next step here and the way that we're going to do that is with a different type of action you're going to go over the action section in the top left and we're going to search for an action called get details of a ui element right here so you'll see there's a ui automation category a data extraction subcategory and we're going to use this option here called get details of a ui element in a window and we're going to take this we're going to drag and drop this before we close the application we're going to put it right here okay and so we're going to bring in and store a the output of what is in our application and so what we're going to have to do is we're going to tell power bi within our contoso invoicing application what is the ui element that we want to extract so ui elements are basically all of the different things that you see on your screen all the different elements here are ui elements and so we're going to specify a new ui element here by hitting the down arrow and we're gonna hit add ui element and what that will do is it'll bring up the tracking session and if you read it very carefully you'll hold down control and left click to pick on an area of the application so by me holding down control and left click i can capture this ui element here and extract the value out of it to use it somewhere else so if i hit control click notice there it captured the ui element and it stored it as text 111 so we're going to go ahead and hit done and you can see here it's going to store it in what's going to eventually be a flow variable called attribute value that's fine we'll go ahead and hit save and so right here it's taken the ui element captured the value and it stored it in a variable called attribute value we're going to actually take the value of that flow variable and pass it into an output variable by using another action called set variable okay so let's bring in set variable and drop that right below our extraction piece here and we're going to say that we want to set our account id variable that's the one that we created as an output variable and we want to pass into it our attribute value so we're passing basically we're passing between variables we're passing from our flow variable into our output variable and it is necessary to do this extra step if you want to have this output variable available in other applications like cloudflows for example so i'm going to go ahead and hit save remember flow variables are only available within the context of this flow i can't access them externally from this flow that's why we need to stick that into an output variable but what we've done here is we've now set that we want to pull information like the account id store it in a variable called attribute value that's this one and then we want to pass that attribute value variable that's a flow variable into our output variables we got a lot of moving parts here but let's test this out i'm going to go ahead and save this and we'll go ahead and hit run and let's see what happens notice the variable window on the far right above my head here so you'll see that the values are passed in and we're going to hopefully get an account id put into the output variable and we most certainly did so let's let this application close after five seconds boom it goes now notice over here above my head the variables did properly mesh it took our value from attribute value right here and it plugged it into our output variable called var out account id and again the reason why we want to move it from one variable to another is because flow variables are not really accessible outside of this flow so by putting it into an output variable it allows me to there then use it in other applications very easily so this is a very quick little demonstration of how to work with variables what we're going to be talking about in our next video is how we could potentially execute this desktop flow from a cloud flow and then pass in values from a cloud flow so that's where the the user defined variables the input values and the output values our input variables and output variables will be especially helpful because there in the cloud flow we'll be able to pass in new values and really the world is open to you at that point within the cloud flow you can capture things from anywhere including like an email or ai builder or a power app and be able to send values into your desktop flows from the cloud flow so that's where we're going to look at our next video hopefully you enjoyed this one take care thank you so much
Info
Channel: Desktop Data Crunching
Views: 10,377
Rating: undefined out of 5
Keywords: Power Automate, RPA, Robotic Process Automation, Power Platform
Id: jTqMjnfC5FA
Channel Id: undefined
Length: 15min 16sec (916 seconds)
Published: Tue Jul 20 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.