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
Example
Track failed devices
Collect devices that fail VLAN configuration:
The result is that failedDevices contains all devices where configuration failed.
Platform 6 changes
What changed
Platform 6 requires arrays to exist before use.
Migrate your workflows
Add a newVariable task before pushToArray:
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,
failedDevicesrather thanarray1. - Handle errors: Add error transitions from
pushToArray. - Multi-thread: Create multiple variables in parallel.
Related tasks
- newVariable — Create job variables.
- query — Extract data from arrays.
- merge — Combine objects.