unshift
  • 23 May 2023
  • Dark
    Light
  • PDF

unshift

  • Dark
    Light
  • PDF

Article summary

unshift Task Purpose

The unshift task is used to add an element to the beginning of an array.

Potential Use Case

Suppose you have an older device that is listed for updating in a dataset and you want to insert a new device that will get the update first. You could run the unshift task to list the new device at the beginning of the dataset.

Properties

Input and output parameters are shown below.

Incoming Type Description
arr Array Required. A given array to add an element to at the beginning.
elementN * Required. The element added to the beginning of an array.


Outgoing Type Description
unshiftedArray Array The shifted array with the new element at the beginning.

Example

In this IAP example:

  • The Reference value for the arr variable is ["oldDevice"], and the elementN variable is statically set as ["newDevice"].

    unshift-01


  • The incoming variables are displayed under the Incoming tab in Task History, which is accessed from Jobs in Operations Manager.

    unshift-02


  • The unshiftedArray variable that returns has shifted ["newDevice"] to the beginning before ["oldDevice"], which changes the order of the array.

    unshift-03


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.