How to Add element to Arraylist with using "invoke method"



Hi everyone

I tried hours but I could not make it out so I want to ask you about using Invoke method to add element to Arraylist.
As you can see in below, I configured ArrayList(and List, I used to tried) as TargetObject of Invoke method, but error happens with message like this.

Main has thrown an exception
Source: Invoke method
Message: Value cannot be null.
Parameter name: TargetObject

I looked for “invoke method” in offical activity guide so I cannnot find out how can I use.

Could you tell me how to add element into arraylist or list ?(If the way using invoke method, it could be good)

I upload my .xaml so please check it.
Main.xaml (12.8 KB)
Main.xaml (12.8 KB)



Make sure you have initialized your ArrayList before performing InvokeMethod

al = new ArrayList()


hi vvaidya

can I ask you a quastion about your reply?

usually in coding, we need to declare and use constructer when we want to use valiables.
Is it also needed in UiPath coding ?
I thought it is enough to use valiables by just making new valiables in valiable panel…


hi vvaidya

Thank you for your advice!
I make it worked properly!