Always Create A Config For Your Power Automate Desktop flows!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
every Power automate desktop flow should have a config where we store the workflow settings in this makes it very easy to maintain workflows we can also have business users with access to the config but not to the actual code very convenient because then we will have no unwanted edits of our power to make desktop flows let me show you how we can set up first a config for a single project and then a config framework which you can use for all your workflows we're only going to build it one and then we will of course reuse everything here I created a power automate desktop flow called Star Wars demo please do the same and do all the same things with me today you will learn so much faster then we need to create the config go to your start menu search for File Explorer go click it that will open up your files we will need to talk about where we want to place the config usually I will place it in documents so I'll find that but you can place it anywhere you want if more users needs to have access to it make sure you choose drive and a folder where those users have access to that could be a network drive so in here my documents I'll just right click say new folder and then we will give it a name power automate configs a hyphen and then do not delete so I don't accidentally delete it then I'll click enter now we have the folder then we'll double click to open it here our configs will go we will have one config pair workflow that will be named the same as the actual power to make desktop workflow so here I right click I'll say new and I'll choose in Microsoft Excel worksheet I choose Excel because very easy to edit values in here everyone can do that even the business users you can of course also choose a text file for example in a Json format I recommend using Excel and that's what we'll be doing here in this guide then we will give it a name so this one will have the same name as the actual flow it's called Star Wars demo I'll click enter I'll have this Star Wars demote.xlsx this is just the extension and that is just because here in view I'll choose to show and then I'll have file name extensions you might just have this so that's why and here I'll enable it again I like to have those that's just the only thing that you might have different so now we have it and I can double click to open it that will open up the sheet it's called Arc one or sheet1 at yours let's just first rename that so I'll right click rename and here I'll call this one Constance it's very important that you do this with me then we will have one column header call Key and another one value here our settings will go in so the setting will have a name that will be the key and then the value will be the settings actual value let's create a few different key value pairs here the first one that will be the API endpoint we're going to create an example with a Star Wars API a workflow where we will choose the invoke web service could be anything then I also won the URL might also want an environment and I want a no t no TV locations settings so first we will need an API endpoint value I've found a Star Wars API here it's free so you can also use it just go to this URL or simply just find in the description below and copy the URL over to our config then we go up here Ctrl V paste it in and we have it here let me also resize this by double clicking it so here I'll right click remove hyperlink it's not necessary but I like to have text values here in my config instead of clickable links because I often try to click in and that will will be a little bit confusing we will need a URL so let us just put in something like https and asians.org again right click remove hyperlink not needed for our config you can have these clickable links in your config if you want this one will be testing and the notification settings that could be an email in my place I'll just have my own email like this again remove the hyperlink in this particularly lesson that I've created for you today we will only use the API endpoint but I choose to fill in three more so you can see we can have more values in the config usually in a real live project that is not an example like here I will have between 5 and 10 different key value pairs remember to save it and then we can close go to the file explorer again and we need to get the path of this config folder so shift right click and then choose copious path we now have the path to this folder now clipboard it's very important that you press shift on your keyboard and then right click with your mouse otherwise you won't see the copious path we can go to Power to make desktop here we have a Star Wars demo flow first we will have a variable that will hold the name we cannot get that automatically with an action so that's why we just do it manually here you will have the workflow name and the value will correspond to this one up here that will be every time you create a flow you will have a workflow name variable with the workflow name and the value so Star Wars demo like this then we will create the subflow where the config is created so if this was a real live flow you will have your usual flow here and then we will have a subflow where our config would be created and initialized and subflow is simply just a child flow which we can call here from Main then the subflow will be performed and we'll come back to the main go up to this drop down where it says subflows click new subflow and we will call this one config this is our shop flow the first thing we will need to do is to have a path to the actual config we created that and we have it in the clipboard the name will be config path and the value control V to paste in the path delete the two quotation marks like this and click save now we want to read the Excel sheet and we want to take the key value pairs from there and paste it in to format.power2mate desktop can use in our case ajson format what how can we do that we can do that this with actions that will take a long time and will be difficult here and there but let me show you a trick so search for a run VB script and the VP script is simply just a little bit of code that we run that can do all this for us because yes I have created this for you so go to a browser and I have a link for this text file here it's in my Google Drive so simply just the link is in the description below so go here what you do here is to copy everything Market control C make sure you have everything then you go back to Power automate desktop the VB script to run Ctrl V here like this and then the variables produced is called the config as Jason and let me just show you what this script does scroll a little bit up here if I can catch it here it is we are opening an Excel workbook and here we use the variable called config path we have it here the workflow name we also defined that in the main so we're using two variables here we read in the constant ch then we start at Row 2 since we have column headers and here we are doing reading everything where we will um replace for example One backwards last two backward slashes because that is required in a Json format we are creating this Json format with the key value pairs where we'll also have the quotation marks and the colons between them and finally we're outputting them to power automate desktop and they will get stored in configuration I can click save here so when we have this Json we also want to convert it to a custom object in that way power automate desktop can work with those so here I'll find a convert Json to custom object the variable used that will be configuration here and down here let's rename this to config as custom object so I'm just renaming the variables so they make sense they again easier to maintain if you want to learn all the best practices in power automate desktop I created a video about that click it up here in the right corner now back to this one here so this is all that is needed to read the Excel into a custom object at Power automate desktop can use and again you can actually use this config path you can instead of having created available you could have used it inside the script I just prefer to have it here it makes it easier to update now we just need to from the main we need to call the config subflow so Urban actions find a run subflow here click the drop down and find the subflow call config we can click save now let's try to run it and you will see that in a few seconds we have a config because if I go over to flow variables and find the config as custom object I'll open it we now have our config in a nice custom object this means that we can refer to this variable and one of these keys to get the value out and then if we have something to change in this workflow we simply just update the Excel sheet and then the next time the flow runs it will have updated values here in our config that's how easy it is let me show you how we can use it so we go to main so after we have this config we can choose to have an invoke web service that will make the API call so drag it in here we need a URL and we find the url we created that called API endpoint and that was in our as in our config so in config as custom object then we'll have a hard bracket a single quotation marks and here you will say API endpoint single quotation mark and a hard bracket method will be get that says that we get some data and then in the accept we will have a Json we're going to look for the web service response so we go down here to variables produced and let me just disable the two other ones so we don't confuse ourselves sometimes you want to use them but for our simple case this will just be an API call we just want to see the config works and then we will do some more advanced things afterward try to run it and now we're using um a value from our config as custom object so if we go over here to web service response and double click you can see that we actually get a response back from this API endpoint it's a lot of data about the style Wars Starships let us just leave it there is also which film they were used in and a lot of other things that's not the important takeaway from this lesson we just saw that we can get a value from the config and use it in our workflow usually we want to reuse as much as possible now we created a config in which we can use here but instead of creating it each time that we are going to create a workflow I much rather want to have created it once so I'll go back to Power automate desktop here and then I'll create a new flow I'll call this one build config this will be the flow that we will use each time we create a new workflow where we have a config I have a config in almost all my flows that will look like this so it's empty right now here and let's go back to the Star Wars demo to the config here copy these three guys here Mark everything Ctrl C and you can always do control a control C just like you do in Excel when you copy things go to the build config Ctrl V paste them in you will have a an arrow here where it says that the workflow name doesn't exist and we're using that in the VB script we're going to do that that since this will now be a separate flow we will use input and output variables an input variable is simply just an available that we put in whenever we call this desktop flow so go over to input output variables click the plus and click input here you will say workflow name Market control C paste it in here as well the data type will be text so now we have that that one will send in whenever we call it but we also get a variable back called config as custom object that will be a custom object so we will create that as an output variable instead of a flow variable so click the plus click output here and here you will say config s custom object remember to change the data type to custom object mark this paste it in here and click save it will ask you if you want to merge the flow with the actual output yes please it will get moved up here we are now done now we have a template for all our configs so I'll click save here I will close it again so we're back to the Star Wars demo now we can delete the entire config subflow we can do that by clicking the subflows clicking these three dots and say delete yes please we'll also delete this run subflow action so I'll delete that we will have an error here because now our custom config as custom object doesn't exist yet but it will do because now we will call the build config desktop flow and let me again repeat what we did here we build a new flow that we will call it will look exactly like the child flow except for the input output variables but now we will call that and that makes it very easy to reuse because each time we build a new flow we will simply just have a run desktop flow that will run our config so we will not have to create the config each time and since the config is dynamic we will just do this so here you will choose the build config we will have an incoming variable called workflow name we have it up here so workflow name and here you can see the variables produced is called config as custom object that was the output variable that we defined then we'll click save now everything is in place um we have deleted the config subflow we can save it so each time you want to use a config you create it in the config folder that one was here give it the same name as here and then in your flow simply just have a set variable with the workflow name and the name of this and then you will run the desktop flow called build config that is all you need everything is taken care of let's try it again just to see that it works so now we're just calling another desktop flow instead of a child flow again you can see we have our web service response here and we have our cast config as custom object created here that's how easy everything is if you want to know more about all the best practices in power automate desktop then I created a very Advanced video for you here I definitely think you should watch it that will improve your power automate desktop game also my free RPA developer communities here we're more than 8 000 RPA developers ready to help you with your power automate desktop Solutions
Info
Channel: Anders Jensen
Views: 7,673
Rating: undefined out of 5
Keywords: power automate desktop, config, config in power automate desktop, how to create a config in power automate desktop, microsoft power automate desktop, excel config in power automate desktop, anders jensen, configuration file power automate desktop
Id: Ie5W_prEs3I
Channel Id: undefined
Length: 16min 58sec (1018 seconds)
Published: Fri Jul 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.