Power Automate Desktop : Action Level Exception handling

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello techies welcome back to microsoft power automate desktop tutorials in the previous tutorial we have learned about exception handling properties now in this tutorial we will learn about action level exception handling what is action level exception handling if there are any exceptions or errors occur at the action level we can easily handle by using action level exception handling all right if you see on my screen i'm having a flow which i have already explained you but let me show you practically over here i'm having a flow to connect to the database of the sql server and then i'm going to insert the data inside the table employee data with the name of name and salary once the data has been inserted successfully by using execute sql statement it will close the connection by using close sql connection all right this is the normal flow which i have over here to show you practically now if you go for the database i'm having select top thousand id name salary from employee that is database name and employee data emp data is the table name if you see over here in this table i don't have any data let's go ahead let's run the flow by clicking on run first it is going to open the sql connection and after that it has been executed the insert query successfully and inserted the data into employee data table and finally it has been closed the sql connection now once again we will see that we are having the data or not inside the employee table with the name of dave and the salary is 10 000 let's execute that and now if you see over here i'm having an id 1002 and the name is dave another one salary is 10 000 all right this is the happy path scenario over here let's assume if there is any error occurred at the time of insertion of the execute sql statement this is error occurred at the action level at that time how we are going to handle the exception at the action level first of all i will just create an exception over here by double click on that over here what i'm going to do i'm going to make a mistake over here like salary in the salary i'm going to remove y over here so the columns are not matching over here in the insert statement the columns are not matching with the name of the column all right this is the exception that i'm going to create over here to make you understand so how can we go ahead and handle this we have already seen how to see how to check the properties of an action right go ahead and click on on error now i'm going to create a new rule for all the errors i'm going to click on new rule and i'm going to first i'm going to use set variable all right i'm going to save over here as flow fade flow error and i'm going to say over here flow failed while executing all right this is the variable that i'm going to set it as an output over here to get the value as flow failed while executing this is the exception that i'm going to give it at the time of action level exception handling occurred all right now let's go ahead let me click on save now over here you can see a flow variable has been created over here under the flow variables now we'll run the flow once again to see the exception handling at the action level now let's go ahead and let's run the flow flow execution started and you can see there there's an error that we got it that is error in exception error in sql statement invalid column name salary over here so this is the error we got it but what about the action level you can see over here flow error let's double click on that now you can see flow failed while executing all right let's close it this is how we are going to handle action level exception handling by using set variable all right now if you observe whenever you are going to set an exception over here you can see this kind of exception handling symbols that you can see over here you can see whenever you are going to mouse over here you can see handling the following errors that is all errors let's double click on the action once again and over here let me go to on error once again and if you see over here i have set a variable over here so that it has been given the value as an output that is flow failed while executing while we got an error at the action level all right now what i want to do i don't want to throw an error over here if you see i'm going to open an sql and after that i'm going to execute the statement sql statement but i got an error at the time of execute sql statement so before that the connectivity is open still open so whenever you got the error or the execute sql statement i need to close the connection sql connection there are two ways that we can do one is we can go ahead and we can make it to the to run the next action that is first one another one we can execute sub flow from the closed connection by using this action i will explain you these two ways once again so let's double click on the execute sql statement and let's go on error and if you see over here continue flow run so what i want to do i want to go to the next action that is what is the next action that is close sql connection even if you got an error at the action level you are going to execute the next action that is close the sql action this is the immediate action that we have for the close sql connection all right let's click on save now once again let's run the flow to see the output now if you see even after we have executed the execute sql statement and it has been thrown an error saying that flow failed while executing and after that if you see over here the status of the flow has been executed successfully that is what is that mean it has been executed immediately that is close sql connection to make you understand what i'm going to do i'm going to put a breakpoint over here i just click it over here at the step 3 so that you will get a break point over here to make you understand now let's run the flow once again now if you see we got an error over here and now if you observe over here it is trying to execute the next action the immediate action which we have after the execute sql statement that is close sql connection all right i hope you understand now go to next action by using continue flow run now i don't want to execute the immediate action let's assume i'm having execute sql statement and in between the close sql connection i'm having different actions in that case i'm not going to close the sql connection immediately in that case how can we go ahead and do that so over here the same close sql connection i have created sub flow over here with the same properties that is sql connection is sql connection that is what are the properties that we have the connection string and all these things that which we have in the flow variable that is sql connection all right now what i'm going to do i'm going to execute this close connection sub flow whenever you got an error in the execute sql statement you don't want to execute all the remaining actions you can go ahead and you can execute the soft flow over here by using action level exception handling all right we will see that how we can do that let us double click on the execute sql statement and once again go to on error now if you see over here all errors are you can use it or you can use another properties that is advanced and you can use any one of the predefined properties also you can use it but right now i'm going to use all errors with the new rule that i'm going to define run subflow all right to make you understand am going to delete this set variable and if you see over here run sub flow which flow that i want to run that is the sub flow that is close sql connection if you drop down over here you will get close connection is the subflow all right select that and then you can save it and now to make you understand i'm going to put it in close connection i'm going to put a break point over here all right now let's run the flow to see the output once again now if you see over here we are right now in the close sql connection in the main that we got an error that is as we know that is there is a column mismatch or column is not available with the name of cell sa lar so that it is going to close the connection once you've got the error or the exception at the main flow right now if you see once you run it it will close the sql connection and it will go out of the sub flow and it will goes to the main flow all right i hope you understand how to handle the exception at the action level right i will show you some more properties over here to make you understand let's double click on the execute sql statement now go to on error once again now over here if you see the advanced properties these are all the predefined exception handles that we have it's related to the action level that is to the database so that you can see over here cannot connect to the database if you are unable to connect to the database at that time how we are going to handle the exceptions over here here also the same kind of properties that we have set variable runs of flow that is the first one if you are unable to connect to the data source that is data source is nothing but employee database over here in our scenario next one invalid connection string what is invalid connection string if you see over here i'm having a connection string over here while opening the sql connection right if you see over here provider sql oledb dot one on integrated security is called sspi these are all the things that we have initial catalog employee data source so on so i think sql server 2014 if there is an error or invalid connection string is there at that time what it will do it will throws an error under the category of invalid connection string all right now error in sql statement if you see over here right now we are seeing the error in sql statement in that case the query or the sql statement will throws an error over here in that case we can provide the set variable or we can provide the subfloor to run when an error occurs all right i hope you understand how to handle an exception at the action level by using the properties at the action level in the next tutorial we will learn about the block level exception handling thank you for watching power output tutorials if you have any queries related to this concept please post them in the comment section i will see you in the next session till then bye bye have a wonderful day
Info
Channel: Learning RPA Technologies
Views: 4,786
Rating: undefined out of 5
Keywords: Power automate desktop, power automate, microsoft power automate desktop, microsoft power automate, Microsoft Power Automate, microsoft power automate tutorial, power automate tutorials, Power automate desktop app, Power automate desktop automation, power automate tutorial, power automate desktop automation, Introduction Of Exception handling, Exception handling, power automate desktop exception handling, types of exception handling, action level exception handling
Id: vHp7aJWqSt8
Channel Id: undefined
Length: 11min 59sec (719 seconds)
Published: Mon May 31 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.