> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# unshift

> Use the unshift task to add an element to the beginning of an array.

The `unshift` task adds an element to the beginning of an array.

## Potential use case

Suppose you have an older device listed for updating in a dataset and you want to insert a new device that should receive the update first. Use the `unshift` task to place the new device at the beginning of the dataset.

## Properties

| Incoming   | Type  | Description                                                 |
| :--------- | :---- | :---------------------------------------------------------- |
| `arr`      | Array | Required. The array to add an element to at the beginning.  |
| `elementN` | Any   | Required. The element to add to the beginning of the array. |

| Outgoing         | Type  | Description                                      |
| :--------------- | :---- | :----------------------------------------------- |
| `unshiftedArray` | Array | The array with the new element at the beginning. |

## Example

In this example, the reference value for `arr` is `["oldDevice"]` and `elementN` is statically set as `["newDevice"]`.

![](/_fern-img/0cecdd2d5ff676dec8eb892277275b3fc8508ac1b21d81d7791a7a153bcb8e07.webp)

The incoming variables are displayed under the **Incoming** tab in **Task History** (accessed from Jobs in Operations Manager).

![](/_fern-img/8bdd8c163cdcbaa62cb8c075a077106c477aec93b83b36ccbd5bb68a6086b215.webp)

The `unshiftedArray` variable returns with `["newDevice"]` shifted to the beginning before `["oldDevice"]`, changing the order of the array.

![](/_fern-img/afd3d9eff4221b0642f4ae06ddc9c22a77daa44811a2d257896e45da9bfd52ae.webp)