Invoke Method Activity Add

Hello
It’s my first time using the Invoke Method activity and im very curious on how it works and when is it useful, also i’m having this error right now with this ativity trying to use the Method “Add”. Im trying to understand how does the activity know what im trying to add to the dictionary collection variable.
I helps this is the Practice 3 - Dictionary and integers of the Foundation Course.
Thanks.

@Luis_Fernando

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.

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.

1 Like

Hi @Luis_Fernando,

this is well explained above by @lakshman, whereas you can also refer the official documentation of UIPath for better understanding. Also there are some youtube videos which also explain about this, you can check out Expohub channel which belongs to @RAKESH_KUMAR_BEHERA.

Thanks

1 Like

Hi Luis,

Which type of Dictionary you have defined? What do you want to Add? Please, precise

Normally you have to aim the element you want to Add in the Parameters field by writing that value/variable and specifying its type (which has to match the type of value defined for your dictionary)

You can take a look on this example where they are adding to a Datatable

Hug

1 Like