UiPath

How to use Invoke Method in UiPath

The InvokeMethod activity is another way to implement a code which is outside of the standard built-in activities. You can use this activity to invoke a method of a class. The class does not need to be part of the workflow or use any of the workflow base classes. The InvokeMethod calls a public method of a specified object or type.

InvokeMethod Properties:

MethodName: Assign the method name to this property.
TargetObject: When we want to invoke non-static methods, we need first to create an object that contains the method to execute.
TargetType: When we want to invoke static methods, we specify the type that contains the static method to execute. If the class is non static then keep the Target type as null.
GenericTypeArguments: When we want to invoke a generic method, we specify generic types in this collection.
Parameters: The parameter collection of the method to be invoked.
Result: The return value of the method execution.