InvokeCode

Estimated reading: 3 minutes 2087 views

This activity helps users to extend the functionality of their automation processes by integrating custom C# and VB.Net code. By integrating custom scripts, users can elevate their workflows with advanced functionalities crafted to their precise requirements.

Key Features

1. Code Execution: Run C# and VB.Net code snippets within the workflow without the need for external applications.
2. Error Handling: Built-in mechanisms to handle exceptions and errors that may occur during code execution.
3. Parameter Support: Pass variables and arguments to and from the code, enabling dynamic interactions and data exchange.

Limitations

1. The main method must be static in C# and shared in VB.NET.
2. Arguments passed to the main method are not supported.
a. The main method is the entry point of a program where execution begins. However, in this activity, passing arguments to the main method is not be supported.
3. Using “InvokeArguments” as the class name is not recommended because it should be reserved for identifying arguments that are either passed as input or output values within the code.
4. The argument name should not be a reserved keywords used in the code to avoid compilation errors.
5. When importing or copying the activity from one solution to another, the code text file available in the source solution path will not be copied to the destination solution path. You need to manually copy and paste the code text file to the destination path. 

Properties

INPUT

Language: This parameter specifies the language of the code being written in the “InputCode” field. Choose from the following options in the drop-down menu:
CSharp: Allows the user to input code in C# language.
VBNet: Allows the user to input code in VB.NET language. By default, the option will be “CSharp”. 

MISC

DisplayName: Displays the name of the activity. The activity name can be customized, which aids in troubleshooting.

SkipOnError: Specify the “Boolean” value as “True” or “False.”
True: Continue executing the workflow regardless of any errors thrown.
False: Halt the workflow if it encounters any errors.
None: If the option is left blank, the activity will, by default, behave as if “False” were chosen.

Version: It indicates the version of the feature being used.

OUTPUT

Result: It provides the ability to view the execution status of the activity. It returns values in “Boolean.”
True: Indicates that the activity has been executed successfully without any errors.
False: Indicates that the activity has been unsuccessful due to an unexpected error being thrown.

How to provide the code into the activity?

1. Drag and drop the “InvokeCode” activity and set it as the start node.
2. Double-click on the activity.
3. Click on the three lines in the activity and select the “Edit Code” option.
a. This option allows you to provide, modify, or change the code.
b. Another window labeled “Invoke Code” will be launched.
c. Enter your code here and click on the “Save” button.
4. The code will be displayed in the “InputCode” display area and will be non-editable.
5. To edit the code, you can follow the same steps. 

Share this Doc

InvokeCode

Or copy link

CONTENTS