I created a Main flow and a Global Handler.
When an error occurs, I want the Global Handler to send a mail with a variable from the Main flow.
For instance, I have three customers x - y - z, the robot loops through them and performs some actions.
Then an error occurs on customer y (y is stored in variable “varCustomer”).
Global handler needs to send a mail with the following text in body: "Error occured for " + varCustomer
Can anyone explain me how I pass the “varCustomer” variable from “Main” to “Global Handler”?
Thanks for your reply. That would be a solution indeed, but the application is a bit bigger than in the example. So I want to use a Global Handler, because otherwise I need to implement Try-Catches at multiple places in the code.
It is not yet possible to use the variables of the main directly in the global handler.
But what I do now, is writing the variables I want to use in the global handler to a file (Notepad or Excel). Everytime the variables change, they get written to the file.
In the Global Handler, the first activity I do then, is reading out that file to get the correct variables.
Bro, in Globalhandler, just use the following piece of code in any activity.
errorInfo.Variables(“var1”).ToString, replace the variable name “var1” according to your main.xml variables. that’s it, if you have any issue please let me know.
The way you described to pass variables to the global handler (errorInfo.Variables(“var1”).ToString) works only for string variables, I have a Variable of type UiPath.Core.Browser, and I need to pass it to the global handler so I could close the tab/browser when I have an error in the flow.
I know that I can use try/catch in the main xaml but I prefer to do this in the global handler, do you know of a way I could refer to this type of variable in the global handler?
Hello,
can you plz explain it with screens as i am trying to make this but this error returned "Object reference not set to an instance of an object. "
Thanks in advance