Help - Error using "Add item to List' Activity

Dear All,
I have created 2 different projects as below
1.CollectionExample.xaml - It uses “Append item to Collection” activity
2.ListExample.xaml - It uses “Append Item to List” activity

In addition, i am using a custom library to create a sample “Employee” object and add that to a temporary variable. This temporary object is than added to “collection”(Example-1) or "List(Example-2).

The “collection”(Example-1) works fine, however "List(Example-2) displays error and does not compile.

Example-1 works fine, however Example-2 displays error - “Error ERROR Validation Error Cannot implicitly convert type ‘System.Collections.Generic.List<PracticeLibrary.Employee>’ to ‘System.Collections.Generic.IList’. An explicit conversion exists (are you missing a cast?) ListExample.xaml”

Please can someone review and advise why the activity-“ListExample” is not working.

Kindly let me know in case you require any more details.

Thank you for your time and help.

PracticeLibrary.1.0.0.nupkg (3.8 KB)
ListExample.xaml (11.4 KB)
CollectionExample.xaml (9.1 KB)

HI,

Can you try the following expression?

emplist.Cast<object>().ToList()

However, this activity might not be normal because there is no output list property.

So, can you try to upgrade UiPath.System.Activities package to 22.10.1 if you use Studio 22.10?

Regards,

1 Like

Hi Yoichi,

The error stops however no item is added to the list.

Also, please can you guide me why the explicit cast is required in this case, where as CollectionExample does not require type cast.

Thank you for your time and help.
Regards

Hi,

As i mentioned in previous post, the activity seems not normal. For now, can you try to upgrade UiPath.System.Activities package to 22.10.1 (or 22.4.5)?

Regards,

1 Like

Hi Yoichi,
I am already using the upgraded package. Kindly refer.


project.json (1.5 KB)

Regards

Hi,

Can you try to re-put new AppendItemToCollection activity into workflow? Pr-existing one seems not recovered.

Regards,

Hi Yoichi,

“Add Item to Collection” works like a charm, however it is “Add Item to List” that gives the ERROR.

Any thoughts.

Regards
collection

HI,

Can you share error message etc?

Regards,

Below is the error message while using “Append Item to List” activity

Error ERROR Validation Error Cannot implicitly convert type ‘System.Collections.Generic.List<PracticeLibrary.Employee>’ to ‘System.Collections.Generic.IList’. An explicit conversion exists (are you missing a cast?) ListExample.xaml

Hi,

Can you share your xaml file?

Regards,

Hi Yoichi,

I have already shared my error code in my first post.

Reattaching it again here.

Regards
ListExample.xaml (11.4 KB)

HI,

We need to use new AppendItemToList activity in System.package 22.10.1.
Do you mean you want to use older one?

Regards,

Hi Yoichi,

Yes, i am trying to use the older “Add Item to List” activity.

regards

Hi,

Probably, it won’t work.

Regards

1 Like

Hi Yoichi,

Many thanks for your time and guidance.

Btw are you aware if there is a link to uipath documents which has details of activity methods along with their “arguments and return type” datatype information.

Hi,

Do you mean like InArgument<String> ? If so, the following might help you because of specification of Microsoft WindowsWorkflow Foundation.

Regards,

1 Like

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