> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-platform/6/studio/tasks/reference/push-to-array/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # pushToArray > Use the pushToArray task to add an element to a job array variable during workflow execution. 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](#platform-6-changes) below. ## Configure pushToArray | Property | Type | Required | Description | | :------------------ | :------- | :------: | :----------------------------------------------------------------------------------- | | Select Job Variable | Dropdown | Yes | The job variable to receive the new item. | | Item Location | Dropdown | Yes | Where to find the item: **Static**, **Job**, or **Earlier Task**. | | Item | Varies | Yes | The 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. | Version | Behavior | | :-------------- | :--------------------------------- | | Platform 2023.2 | Creates array automatically | | Platform 6 | Requires array creation before use | ### Migrate your workflows Add a `newVariable` task before `pushToArray`: #### Add a newVariable task Add a new **newVariable** task to your workflow. #### Set the variable name Set **variableName** to your array name. #### Set the initial value Set **variableValue** to `[]`. #### 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](/itential-platform/studio/workflows/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. ## Related tasks * [newVariable](/itential-platform/studio/tasks/reference/new-variable) — Create job variables. * [query](/itential-platform/studio/tasks/reference/query) — Extract data from arrays. * [merge](/itential-platform/studio/tasks/reference/merge) — Combine objects. > Use the pushToArray task to add an element to a job array variable during workflow execution.