> 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/release-notes/breaking-changes/pushtoarray-requires-preexisting-arrays/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # pushToArray requires preexisting arrays > Breaking change notice that the pushToArray task now requires arrays to exist before use in Platform 6. The [pushToArray](/itential-platform/studio/tasks/reference/push-to-array) task now requires arrays to exist before use. Previously, the task created arrays automatically. **What changed:** If you use `pushToArray` with a non-existent array, the task fails and the workflow follows the error path. **Who is affected:** Platform 6 users with workflows from Platform 2023.2 or earlier that use `pushToArray` without creating the array first. ## What happens now ### Error message When `pushToArray` cannot find the array variable, you will see: ``` Cannot destructure property '' of '<_0x8ba882>' as it is undefined. ``` The task enters an error state and the workflow follows the error transition. ### Successful execution When you create the array first, the task completes successfully. ## Fix your workflows ### Find affected workflows Identify workflows that use `pushToArray` without creating the array first. The most likely candidates are: * Workflows created before Platform 6 (2019.1, 2020.2, 2022.1, 2023.1, 2023.2) * Workflows using `pushToArray` in `forEach` loops * Workflows with conditional array creation ### Create your arrays first Add a [newVariable task](/itential-platform/studio/tasks/reference/new-variable) before any `pushToArray` task. Add it at the start of your workflow, before the `forEach` loop if using `pushToArray` inside a loop, or anywhere before the first `pushToArray` task. #### Open your workflow In Studio, open your workflow. #### Add a newVariable task From the task palette, select **WorkflowEngine** > **newVariable**. Drag the task onto your canvas before `pushToArray`. #### Configure the task Open the task and configure: * **variableName** — Enter your array name (for example, `results`) * **variableValue** — Enter `[]` (empty array) #### Save and connect Save and connect the task to your workflow. See [Workflow best practices](/itential-platform/studio/workflows/best-practices) for more details on defining job variables. ### Update error handling If your workflows relied on the old behavior (success path even without an existing array), add error handling: ``` pushToArray ├─→ [success] Continue normally └─→ [error] Handle missing array ``` ### Test before deploying 1. Test all workflows with `pushToArray` in non-production. 2. Verify arrays are created correctly. 3. Confirm error paths work as expected. ## Additional context ### Impact of the change This change particularly affects: * Long-lived workflows migrated through multiple platform versions * Dynamic workflows that create arrays conditionally * Error handling patterns using `pushToArray` in loops ### UI behavior note Both Platform 2022.1 and Platform 6 show a red asterisk (\*) next to the array field. However: * **2022.1** — Visual indicator only. The task still works without creating the array first. * **Platform 6** — Enforced requirement. The task fails if the array does not exist. ## Related reading * [Product Support](https://itential.atlassian.net/servicedesk/customer/portals) * [Workflow best practices](/itential-platform/studio/workflows/best-practices) * [pushToArray task reference](/itential-platform/studio/tasks/reference/push-to-array) > Breaking change notice that the pushToArray task now requires arrays to exist before use in Platform 6.