Append Item to collection Error

Hi all,
Please help me with the right variable type for the append item.

I have attached both old and new version append activity below two screen shots with red markings of my issue(could not append any item to the collection since its showing system.object) in the new version.

Learning from UiPath academy the “Data Manipulation with Lists and Dictionaries in Studio” topic. In the video part 1 they appended an item to the list and its type is list. Same when I tried to follow in latest community version 2024.2 its showing error the following error message.

System.ArgumentNullException: Value cannot be null. (Parameter ‘Collection’) at UiPath.Activities.System.Collections.AppendItemToCollection1.Execute(CodeActivityContext context) at System.Activities.CodeActivity1.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Thanks

Hi @hemauk21

Check the below thread

Regards

1 Like

Clear out whatever you have in the property, put your cursor in the property, press CTRL+K and then type a variable name, press enter. You can do this in all properties, and it’ll automatically create the correct type of variable for you.

The issue here isn’t the datatype, though, it’s that you haven’t initialized it. Go to the variables pane and put New List(of Object) into the Default for the variable.

1 Like

Hi @hemauk21,

Please try the following solution.
BlankProcess.zip (3.2 KB)

Hope it helps you!

1 Like

@hemauk21

Create a variable of type list(of string) and then use it in append item to collection

Else by default it will choose icollect(of object)

Cheers

The Append items to collection activity won’t accept List, it requires ICollection. You initialize it as List:

2 Likes

thank you so much i did clear those field as you suggested and used ctrl+k and then as someone suggested I created list with type of string and now everything is working fine.

1 Like

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