pushToArray

Add elements to an array in a workflow.

Use pushToArray to collect results during iterations, track errors or failures, and build lists dynamically.

Platform 6 requirement: Arrays must be created before using pushToArray. See Platform 6 changes below.

Configure pushToArray

PropertyTypeRequiredDescription
Select Job VariableDropdownYesThe job variable to receive the new item.
Item LocationDropdownYesWhere to find the item: Static, Job, or Earlier Task.
ItemVariesYesThe value to add. Text box for Static; dropdown for Job or Earlier Task.

Example

Track failed devices

Collect devices that fail VLAN configuration:

START → newVariable: failedDevices []
→ forEach deviceList
└─→ Configure VLAN
├─→ success → continue
└─→ error → pushToArray: failedDevices

The result is that failedDevices contains all devices where configuration failed.

Platform 6 changes

What changed

Platform 6 requires arrays to exist before use.

VersionBehavior
Platform 2023.2Creates array automatically
Platform 6Requires array creation before use

Migrate your workflows

Add a newVariable task before pushToArray:

1

Add a newVariable task

Add a new newVariable task to your workflow.

2

Set the variable name

Set variableName to your array name.

3

Set the initial value

Set variableValue to [].

4

Position it before pushToArray

Place the newVariable task before pushToArray in the workflow.

As a best practice, create all variables at the start of the workflow. See Workflow Best Practices.

Best practices

  • Create arrays at start: Define all variables after the Start task.
  • Use descriptive names: For example, failedDevices rather than array1.
  • Handle errors: Add error transitions from pushToArray.
  • Multi-thread: Create multiple variables in parallel.