Utilities transform functions

  • Release version: Zurich
  • Updated July 31, 2025
  • 4 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Utilities transform functions

    Utilities transform functions in ServiceNow enable you to manipulate and extract data from Arrays, Name-Value Pairs, Strings, Integers, or Choice data pills within flows. These functions are essential for transforming input data into complex objects or specific values, facilitating precise data handling and integration tasks. Correct use of input data pill types is crucial, as applying a function to an incorrect type will return the original input without transformation.

    Show full answer Show less

    Key Features

    • Get First Item from Array: Retrieves the first element from an input array as a complex object.
    • Get Item from Array: Returns the Nth item from an array by index (starting at 0) as a complex object.
    • Get Item from Name/Values: Looks up and returns a value by a matching key from a map of Name-Value Pairs, with an optional default if the key is absent. Note that the returned value may be a system value rather than a display value.
    • Get Last Item from Array: Retrieves the last element from an input array as a complex object.
    • Is Blank / Is False / Is Not Blank / Is Null / Is True: Boolean checks for various conditions on input data pills, such as blankness, falsehood, nullness, or truth, supporting strings, integers, and Booleans but not references.
    • Key Value Map: Maps a key to a corresponding value or a default value if the key is not found, useful for translating codes or enumerations.
    • Sort: Sorts arrays (string, integer, Boolean, datetime) in ascending or descending order. Note that sorting strings is case-sensitive.
    • Unique: Removes duplicate elements from arrays, ensuring each element is unique.
    • Join: Concatenates elements of an array into a single string with a specified delimiter.

    Practical Application and Outcomes

    These transform functions empower ServiceNow customers to efficiently process and manipulate data within flow actions, such as REST calls or integrations, where data often arrives as arrays or name-value maps. For example, extracting a ticket ID from a response map or sorting and deduplicating lists before further processing. They ensure data is in the correct format or value to be used downstream in flows, improving automation accuracy and reliability.

    By using these functions, you can:

    • Extract specific elements from arrays or maps with precision.
    • Validate and check data states (blank, null, true/false) to control flow logic.
    • Transform coded values into human-readable strings or other mapped values.
    • Prepare arrays for processing by sorting, removing duplicates, or joining elements into a string.

    Understanding and applying these utilities correctly helps prevent runtime errors and ensures your flows handle data as intended, leading to more robust and maintainable automation solutions.

    Use utilities transform functions to return a Complex Object from an Array, or a value associated with a specific key.

    Utilities transform functions require an Array, Name-Value Pair, String, Integer, or Choice input data pill. Make sure to use the correct input data pill type when applying utilities transform functions. If a utility transform function is applied to an improper data type, the data is not transformed at runtime and the input value is returned instead. For more information on confirming your flow runtime values, see Test a flow.

    Get First Item from Array

    Returns the first item from the input array as a complex object.

    Input data pill Output data pill
    Array Complex Object - First item found in the input array

    Get Item from Array

    Returns a Complex Object from the input Array. Enter a value for the Nth Item in the input Array that you want to return. The Nth Item represents the Array index, starting at 0.

    Input data pill Parameters Output data pill
    Array Nth Item - Enter the index of the target object in the input Array. The Array index starts at 0. Complex Object

    Get Item from Name/Values

    Returns a value that is associated with a matching key from a map of Name-Value Pairs.

    Input data pill Parameters Output data pill
    Name-Value Pairs
    • Key - Name of the key that is used to look up its corresponding value
    • Default - The value returned when there is no matching key
    String associated with the matching key
    Note:
    When applying the Get Item from Name/Values transform function, consider that the runtime value might be the system value, not the display value. For example, if mapping the Priority field in the Incident table to a similar field in a remote table, the returned runtime value might be 2, not 2 - High.
    Example usage:
    • Input: "username":"abel.tuter"
    • Key: username
    • Default: example.username
    • Output: abel.tuter

    In this example, an action makes a REST call to a third-party system and GETs ticket data as a map of Name-Value Pairs. A Ticket ID is provided as an output for this action. The Get Item from Name/Values transform function returns either the value that is associated with the ticket_id key or Ticket ID not found.

    Associated value for ticket_id key or "Ticket ID not found" returned as action output.

    Get Last Item from Array

    Returns the last item from the input array as a complex object.

    Input data pill Output data pill
    Array Complex Object - Last item found in the input array

    Is Blank

    Returns true when the input is blank. A string input is blank when it is an empty string. An integer input is blank when it is zero. A Boolean input is blank when it is false.
    Note:
    This transform function doesn't support reference inputs.
    Input data pill Output
    Any Returns true or false
    Example usage:
    • Input: an integer data pill with 0
    • Output: true

    Is False

    Returns true when the input is false. A string is false when it is an empty string. An integer is false when it is zero. A Boolean input is false when it is false.

    Input data pill Output data pill
    Any Returns true or false
    Example usage:
    • Input: an integer data pill with 13
    • Output: false

    Is Not Blank

    Returns true when the input is not blank. A string is not blank when it is not an empty string. An integer is not blank when it is anything but zero. A Boolean input is not blank when it is true.
    Note:
    This transform function doesn't support reference inputs.
    Input data pill Output data pill
    Any Returns true or false
    Example usage:
    • Input: an integer data pill with 13
    • Output: true

    Is Null

    Returns true when the input value is null. An input is null if it is not initialized, or if it is a null object or reference.

    Input data pill Output
    Any Returns true or false
    Example usage:
    • Input: an integer data pill with 725
    • Output: false

    Is True

    Returns true when the input is true. A string is true when it is not an empty string. An integer is true when it is anything but zero. A Boolean input is true when it is true.

    Input data pill Output data pill
    Any Returns true or false
    Example usage:
    • Input: an integer data pill with 13
    • Output: true

    Key Value Map

    Returns a value associated with a matching key, or a default value if there is not a match.

    Input data pill Parameters Output data pill
    String or Integer
    • Name - The key that is used to find the corresponding value
    • Value - The value matched to a specific key
    • Default - The value returned when there is no matching name
    String associated with the matching key

    Example usage:

    In this example, a log action stores a record's priority as a message. In the Name-Values section, each priority is mapped to a corresponding string value. When the flow runs, the record's priority number is transformed to a string, and the string is logged to a message.

    A Key-value map transforms a value from a number to a string.

    Sort

    Sorts the specified array in ascending or descending order.

    Input data pill Parameters Output data pill
    Array.String, Array.Integer, Array.Boolean, or Array.Datetime. - Unsorted array Sort Order - Ascending or descending Array - Sorted array
    Note:
    Sort function is case-sensitive for array.strings.
    Example usage:
    • Input: [7, 2, 3, 1, 7, 9]
    • Parameter: Ascending
    • Output: [1, 2, 3, 7, 7, 9]

    Unique

    Removes the duplicate elements from the specified array.
    Input data pill Output data pill
    Array.String, Array.Integer, Array.Boolean, or Array.Datetime. Array - After duplicated elements are removed
    Example usage:
    • Input: [7, 2, 3, 2, 7, 9]
    • Output: [7, 2, 3, 9]

    Join

    Concatenates the individual elements of the specified array with the specified delimiter and returns the concatenated string.

    Input data pill Parameters Output data pill
    Array.String, Array.Integer, Array.Boolean, or Array.Datetime. Delimiter - Character that separates the individual elements after concatenation. String - String after a delimiter is added.
    Example usage:
    • Input: [1, 2, 3]
    • Parameters: <
    • Output: 1<2<3