How to use the Invoke method to add value in list

Hi,
I was trying to add a value through the Invoke method , to add in a list. but was not able to complete as getting
“‘List`1’ does not have a public instance method named ‘add’ matching the parameter types, generic type arguments, and generic type constraints supplied to InvokeMethod ‘Invoke method’”

this issue.
sharing the screeshot herewith.
It will be a great help if you can provide me the right direction.

Hey @sain87

Try This :slight_smile: invoke_list_add_sample.xaml (6.9 KB)

Regards…!!
Aksh

3 Likes

Hi Aksh,
Thanks for your reply.
What i found that , the method name i was using was “add” and it was throwing the above error, but by updating the name to “Add” it worked.not showing the above mentioned error.

1 Like

Good to Know :slight_smile:

Even with method name “Add” doesn’t change… the error message is same to me

As karthik said even for me same issue exists, Im unable to add more than one element in the list.

Hi @nikhil_rao,

Here is an example. check it out.

Regards
Balamurugan.S

Thank you

1 Like

Welcome to UiPath Forum Community !!

Regards
Balamurugan.S

Same is the case with me. While I am trying to add one element its getting added but while adding multiple elements it shows the same error.

@G00119 Can share your screenshot of your workflow and error screenshot?

@Manjuts90 I try to add the multiple element from the array to the list or directly using the collections parameter in the invoke method it will show me the error while creating so the workaround I did is to iterate through each element and then invoke the add method for each element. The screen shot for the earlier method where I was getting error is attached below

.
Below are the values passed in the collections parameter of the invoke method.

@G00119 Please check below link.