Use of Invoke Method

Hi All,
I have gone through all the post regarding Invoke Method , but I m not getting the concept of Invoke Method.
It has Target Type-it has many items like null ,int32,string.
Target object-what is this???
Method Name:-are these method are predefined or User Defined?
Parameter : how to use this .
can someone give full concept of Invoke Method. How and where to use it.


hi @Amarjeet

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.



Hello Akshay
I didn’t understand your explanation aswell.Please find the below scenario.

Dataset ds=new Dataset();

Datatable DT=new DataTable();


How can I acheive that in Invoke method


i think its this way


Thank you verymuch. I just have one more doubt

I created a datatable as

kit=new datatable(“Kitti”);
kit.tablename.tostring()—> prints correctly

but after adding to the dataset If i try to access by table name a s follow
ds.tables(“kitti”).rows.tostring this throws an error
and ds.tables(0).tablename.tostring() is printing TableName when my table name is Kitti


Below is the code

ds.tables(“kitti”).rows.tostring — Output —> System.Data.DataRowCollection
and ds.tables(0).tablename.tostring() – Output —> Kitti (unless you are creating anaother DataTable with name TableName before Kitti)


when I print ds.tables(0).tablename.tostring() – Output —> TableName
and ds.tables(“kitti”).rows.tostring-output object reference error

Are you doing anything else???

May be you did not add “dt” to the parameters in Invoke Method


If I don’t add I can’t access tables(0) aswell. But I am able to access the rows of my DT table using the Tables(0)

Try replicating my code in above image, or please attach your code.


I just found the problem If we use Build Data table after creating the new instantiation
Dt=new DataTable(“Kitti”);
and then if we print
ds.tables(0).tablename.tostring()-- Output —> TableName
otherwise its printing properly. Why is this happening???

Please add a reproduction workflow - it will make it easier for all to debug and see if it’s something wrong with the way you used the code or is there an actual bug.

Preferably include there a sample that works and the one that doesn’t - usually you’ll see what’s going on when doing those anyway.


1 Like

brilliant explanation.

Hi @vvaidya/ @aksh1yadav ,

I’m reading a excel and storing the data in the datatable.
Now i need to delete a column from the datatable using invoke method.
How can i do it ? Please help me.
dbReport is the table name.


Hey @Hemanth_Gali

Please visit this link:


thank you for your reply @aksh1yadav , but my requirement is to delete column.:neutral_face:

Sorry, in hurry did not read your question well.
Check the Edited Post of mine. @Hemanth_Gali


1 Like

Hi Team,

Invoke method implementation is quite simple, this is used when we try to implement something beyond our builtin activities. You can use this activity to invoke a method of a Nonstatic or Static class.

Steps for invoke Method implementation:

Example using Static Class
1 Create a .net Class Library project.
2. Create a non_static class having a non static method on it.
(Make sure that you have added the required namespace: System.Activities.presentation.Metadata and System.ComponentModel)
3 Build the project in release mode.
4 Create a nuget package and save to the the activities location in your system"UiPath\app-17.1.6522".
5 install the nuget package to the UiPath Project.
Target Type: If the class is non ststic then keep the Target type as null.
Target Object: Create a instance of the class.ex new ClassLibrary1.Validate
Method Name: Provide the method name, ex ValidateString
Pass the result to a variable, ex result
Task is complete
With Static Method

TargetType Target Type must be the class instance.




Cool! That’s exactly what I want!

But I am confused with two points:

4 Create a nuget package and save to the the activities location in your system"UiPath\app-17.1.6522".
5 install the nuget package to the UiPath Project

How can I create a Nugget Package?

And more important, How can I Install a nugget Package in UIPath Project?

Please read this post to create a Nuget Package.