Skip to content

Add to List

Type: list-add  ·  Package: Collections Activities v1.0.3  ·  Output: none

Adds an element to the end of a list. It is the activity to accumulate data: keep storing each result as you loop through something.

Appends item to the end of list, modifying it directly: any variable pointing to it sees the change. The list must exist (create it first with Create List). Repeated elements and null are allowed.

If the list has a specific type (for example, the List<string> returned by split(...)), the element must be of that type; lists created with Create List or newList() accept any value.

ParameterTypeDefaultDescription
listList—The list to add to.
itemobject—The element to add.

None.

This activity does not return a value; it modifies the list in place.

MessageCause and fix
'list' must be a List, got ….list is not a list (the message shows the type received, or null if the variable is empty). Create it first with Create List.
The value "…" is not of type "…" and cannot be used in this generic collection.The list has a specific type and the element is of another one (.NET message). Convert the element, for example with str(...).
Create List → output: pending
For Each items = invoices itemVariable = invoice
└─ activities:
If condition = str(invoice["Status"]) == "Pending"
└─ then:
Add to List list = pending item = invoice["Number"]
Log message = "Pending invoices: " + join(pending, ", ")