Issue with invoke methode

hey, dears,
I am new in UIpath and I has a small problem when I try to add a new string to list as in the start course as in video by using invoke method the following message appears
TargetType and TargetObject are mutually exclusive for InvokeMethod ‘AddToList’.
what shall I do
Best Regards

@aadam
Use Add

1 Like

Hi @aadam

You can add items to a list in many ways. If you are using a List variable to which you want to add items to, you can use either Add To Collection activity or the Invoke Method.

Add To Collection is pretty straight forward

However, if you wish to use the Invoke Method, for the method name, use “Add” and specify the target to your List variable.

This should work for you…

2 Likes

i am using invoke method and the errors appears even i use add method and specify the target method list

@aadam
Suppose if you are creating a new List let us take as List A which contains strings.
Now you have initialize first as new List(Of String)
Then use Invoke method.
Target Object as List A
Give Method name as Add
Pass the argument as string which you want to add to list.
If you want to add existing list then no need to initialize.

Regards,
Mahesh

2 Likes

i do that and select the list that i initialize its value

Let know how it goes for you…

1 Like

thanks for your kind support :slight_smile:

  1. i create a list as following
  2. i add invoke method as following:

    3.i add the value as following:

    4.and i got the following error :slight_smile:

Best Regards

@aadam

Use Capital A in Add

1 Like

No change

Clear Dic variable Default value

1 Like

Hi @aadam

Check this workflow for example

AddItemsToList.xaml (5.6 KB)

it should work for you

1 Like

@aadam, did it work for you? if it did, please mark the appropriate answer as the solution so it could help others as well… by the way, welcome to the community!!!

2 Likes

Thanks a lot for your kind support i works properly

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.