Synchronously invokes VB.NET or C# code, optionally passing it a list of input arguments. This activity can also return out arguments to the caller workflow.
The assemblies referenced by your code need to be added into the Imports panel in order to function. You can find more info here.
- Arguments - The parameters that can be passed to the code that is invoked.
- Code - The code that is to be invoked. This field supports only strings and
- Language - A drop-down menu that specifies what language the invoked code is written in. The available options are VBNet and CSharp.
- DisplayName - The display name of the activity.
- ContinueOnError - Specifies if the automation should continue even when the activity throws an error. This field only supports Boolean values (True, False). The default value is False. As a result, if the field is blank and an error is thrown, the execution of the project stops. If the value is set to True, the execution of the project continues regardless of any error.
If this activity is included in Try Catch and the value of the ContinueOnError property is True, no error is caught when the project is executed.
- Private - If selected, the values of variables and arguments are no longer logged at Verbose level.
The Invoke Code activity is used for directly calling
vb.net code from the UiPath platform. Using this activity you can specify exactly what code to be executed and what arguments to be passed to and from the activity.
This is how the automation process can be built:
- Open Studio and create a new Process.
- Drag a Sequence to the Workflow Designer.
- Create the following variables:
- Drag an Assign activity inside the sequence container.
- Add the variable
ExampleInArgumentin the To field and the expression
"Example for In Arguments"in the Value field.
- Add the variable
- Add an Invoke Code activity below the Assign activity.
- Select the Edit Code button for introducing the desired code.
- Type the code in the Code Editor window. For this example we have added a simple code that writes a string on the screen. Here is the code we have used:
Dim TextToWrite As String TextToWrite = "Example" Console.WriteLine(TextToWrite)
- Select the OK button to close the Code Editor window.
- Select the Edit Arguments button and create the following arguments:
- Select the OK button to close the Invoked code arguments window.
- Place a Write Line activity under the Invoke Code activity.
- Add the expression
OutValue.ToStringin the Text field.
- Run the process. The robot displays in the Output panel the code and arguments specified by you in the Invoke Code activity.
Updated 13 days ago