Invoke Method and Invoke Code for UiPath Automation Developer Professional exam

Invoke Method:
The Invoke Method activity helps you to call a method that is outside the standard built-in activities. It is used to call a specific method in a class. The class does not need to be part of the workflow or use any of the workflow-based classes. The activity calls a public method of a specified type or object. It acts on either Target Type or Target Object

When is the Invoke Method activity useful

  • When you have a class library/DLL in vb.net or c# and want to call that method.

  • When you want to use a method that does not generate an output (for example, Reverse) and therefore cannot be used in an Assign activity.

  • When you want to use a method that generates several pieces of output (for example, TryParse which generates a Boolean and an Int32). Several values cannot be assigned using an Assign activity.

Invoke Code
The Invoke Code activity synchronously invokes VB.NET or C# code, with the option of passing input arguments.

When is the Invoke Code activity useful

  • When you want to simplify data manipulation procedures in your workflow.

  • When you want to reduce the number of Assign and Invoke Method activities, by replacing several with a single Invoke Code activity.

  • When you need to write custom code for some steps in the process.

Adding imported Name Spaces

  • When using VB.NET code in Invoke Code activity, the assemblies must be added to the Import panel for them to function when executing the code.

  • The Invoke Code activity cannot define classes, modules, methods, or procedures, but variables’ declarations and instructions can be coded directly. Also, it does not support functions, procedures, or methods. Therefore, you should remove any code lines associated with them to avoid run-time errors.

3 Likes

will this be similar to what is asked on the actualy UIARD exam?

Yes you will get questions from it