Add item to collection
The Add item to collection action A tool for building the processes, logic, and direction within workflows. adds an item to the specified collection A variable containing multiple items, such as email addresses. Collection variables are useful for storing and operating on query results. For example, you can set up collection variables for names, email addresses, and index values to store results from querying a list. You can then loop through items in a particular collection variable (names, emails, or index values)..
For example, while iterating through query results you might use this action to add an item at each iteration. You can also use this action within the Loop for each action.
Before you begin:
-
Understand Variables
-
Understand the Start a loop and Loop for each actions
Jump to:
Add and configure the Add item to collection action
In the Designer page:
-
Click the Collection operations action group in the action toolbox.
or
Find actions by browsing action groups, or by typing an action name or function in the Search field at the top of the action toolbox.
- Drag the Add item to collection action to the point in the workflow when you want to add an item to a collection variable.
- Click the Add item to collection action.
-
Complete the fields. For more information on the fields, see Add item to collection fields.
Field
Example configuration
Example returned contents
Target collection collProduce apple; carrot; romaine
Index
2
Value
parsley
Output
collProduce
apple; carrot; parsley; romaine
Field |
Description |
Variable types |
---|---|---|
Target collection | Collection variable that you want to add the item to. The Target collection variable must be the same as the Output collection variable. Accepts an inserted variable. |
Collection |
Index |
Index (location or counter) to be used for the new item. Accepts either typed text or an inserted variable. |
Integer |
Value |
Value associated with the item. Accepts any combination of typed text and inserted variables. |
Boolean, DateTime, Decimal, File, Integer, Text |
Output |
Collection variable to store existing items and new item. The Output collection variable must be the same as the Target collection variable. Accepts an inserted variable. |
Collection |