Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Teams
, (opens new window)

Power Scripts for Jira Cloud
Results will update as you type.
  • Get started
  • Configuration guides
  • Integration guides
  • Feature guides
  • Advanced features
  • Migration resources
  • Simple Issue Language
    • Getting started with SIL
    • SIL reference guide
    • SIL Functions library
      • Function Index
      • Packages
      • Array Functions
        • arrayAddElement
        • arrayAddElementIfNotExist
        • arrayDeleteElement
        • arrayDeleteElementAt
        • arrayDiff
        • arrayElementExists
        • arrayFind
        • arrayFindBinary
        • arrayGetElement
        • arrayIntersect
        • arrayKeys
        • arrayKeySort
        • arraysConcat
        • arraySetElement
        • arraySize
        • arraySort
        • arrayStructMap
        • arrayStructSort
        • arrayToSet
        • arrayUnion
        • excludeSubarray
        • subarray
      • Basic Functions
      • Date and Interval Functions
      • Excel Functions
      • File Manipulation Functions
      • HTTP Functions
      • Incoming Mail Processing Functions
      • Integration with Other Systems
      • Jira Administration Functions
      • Jira Integration Functions
      • Jira Service Management Functions
      • Jira Software Functions
      • Listener Functions
      • Math Functions
      • Parameter Functions
      • Scheduling Functions
      • String Functions
      • System Integration
      • Webhooks Functions
  • Tutorials and recipes
  • Jira Product Discovery support
  • Release notes
  • Help and support
    You‘re viewing this with anonymous access, so some content might be blocked.
    /
    arraySetElement
    Updated Aug 08

    arraySetElement

    Syntax

    arraySetElement(array, index1, elem)

    Package

    array

    Alias

    setElement(array, index1, elem)

    Pkg Usage

    setElement(array, index1, elem)

    Description

    If elem is an element of the array type, returns a new array with the specified element on position index1. If index1 is greater than the array size, it will add empty elements on the missing positions.

    Parameters

    Parameter name

    Type

    Required

    Description

    Parameter name

    Type

    Required

    Description

    array

    Array

    Yes

    Array where to add the element.

    index1

    Number

    Yes

    Position where to add the element.

    elem

    Matches type of array element to be set

    Yes

    Element to add to the array.

    Return Type

    Element of the array type

    Example

    watchers = setElement(watchers, 12, currentUser());

    Sets the value currentUser for the 13 th element of the array watchers.

     

    1. If array is not defined as an array, the function returns error.

    2. If index is not number the function returns error.

     

    Starting with version 2.5 we added the indexing operator. It will work on arrays, strings, dates and interval.
    You can simply write in your programs watchers[12] = currentUser() to refer to the 13 th element in the watchers array.

    See also

    • Page:
      arraySetElement
    • Page:
      arrayDiff
    • Page:
      arrayKeys
    • Page:
      arraySize
    • Page:
      arrayUnion
    • Page:
      arrayDeleteElement
    • Page:
      arrayStructMap
    • Page:
      arraysConcat
    • Page:
      arrayElementExists
    • Page:
      arraySort
    • Page:
      arrayGetElement
    • Page:
      arrayAddElementIfNotExist
    • Page:
      arrayToSet
    • Page:
      arrayStructSort
    • Page:
      arrayFindBinary
    • Page:
      arrayDeleteElementAt
    • Page:
      arrayAddElement
    • Page:
      arrayFind
    • Page:
      arrayIntersect
    • Page:
      subarray
    • Page:
      excludeSubarray
    • Page:
      arrayKeySort
    Peacock

    Need support? Create a request with our support team.

    Copyright © 2005 - 2025 Appfire | All rights reserved.

    {"serverDuration": 14, "requestCorrelationId": "c3d7e0670f9d40eb94a0e9bc58415eb8"}