List connector methods

  • 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 List connector methods

    List connector methods enable automation workflows to perform a variety of actions on list items within ServiceNow. Before using these methods, they must be exposed and properly configured. These methods allow you to add, search, update, remove, and manipulate list items efficiently as part of your workflow automation.

    Show full answer Show less

    Key Features

    • Add: Adds a single list item by specifying the item object.
    • AddList: Adds multiple list items at once by passing a list of objects.
    • Contains: Checks if a specific list item exists and returns a Boolean result.
    • Count: Returns the total number of list items added.
    • FindByProperty: Finds a list item based on a key-value pair and returns the item if found, along with a Boolean indicating success.
    • FindText: Searches text or regex within list items, returning the count of matches and a list of matching items.
    • GetItem: Retrieves a list item by its index.
    • GetItems: Retrieves multiple list items by configuring and specifying their index values.
    • GetList: Returns all list items and lists currently created.
    • Remove: Removes a specified list item.
    • RemoveAll: Removes all list items added.
    • Reverse: Reverses the order of list items based on their index values.
    • SetItems: Updates values of list items by configuring index values and providing new data.
    • Sort: Sorts the list items.
    • ToArray: Converts list items into an array format for further processing.

    Practical Use and Configuration

    Many methods require configuring input parameters via data ports, such as specifying list items, index values, or search criteria. Methods like GetItems and SetItems require pre-configuration of index values to define which items to retrieve or update. Data types and mandatory parameters must be set according to the method’s requirements to ensure proper execution.

    Benefits for ServiceNow Customers

    Utilizing these list connector methods allows ServiceNow customers to automate complex list manipulations within workflows, improving efficiency and accuracy. The ability to programmatically manage list items—adding, searching, updating, or removing—supports more dynamic and responsive automation solutions aligned with business processes.

    The List connector methods perform various actions on list items as part of an automation workflow. You must first expose the methods before using.

    Add

    Adds a single list item.

    To provide inputs to the parameters, see Configure port properties.

    Table 1. Add method parameters
    Parameter Description Data port type Data type Default value Mandatory?
    Item Name of the list item. Data in Object None Yes

    AddList

    Adds a list of items.

    To provide inputs to the parameters, see Configure port properties.

    Table 2. AddList method parameters
    Parameter Description Data port type Data type Default value Mandatory? Notes
    List List of items. Data in Object None Yes You can pass the list items from a variable or an appropriate component.

    Contains

    Returns the Boolean value based on whether a list item exists.

    To provide inputs to the parameters, see Configure port properties.

    Table 3. Contains method parameters
    Parameter Description Data port type Data type Default value Mandatory?
    Item Name of the list item that the method searches. Data in Object None Yes
    Return Returns True if list item found, else, returns False. Data out Boolean Not applicable Not applicable

    Count

    Returns the total count of list items added.

    Table 4. Count method parameters
    Parameter Description Data port type Data type Default value Mandatory?
    Return Returns the total count of list items added. Data out Integer Not applicable Not applicable

    FindByProperty

    Finds a list item based on the specified key and value. You must create at least one key value pair list item before executing this method.

    To provide inputs to the parameters, see Configure port properties.

    Table 5. FindByProperty method parameters
    Parameter Description Data port type Data type Default value Mandatory?
    Prop The key in the key value pair. Data in String None Yes
    Value The value in the key value pair. Data in String None Yes
    Found Returns True if list item found, else, returns False. Data out Boolean Not applicable Not applicable
    Item if the Found parameter is True, the method returns the list item. Data out Object Not applicable Not applicable

    FindText

    Finds text or regex in the list items based on the specified filter and returns the total occurrences of the text and the text itself.

    To provide inputs to the parameters, see Configure port properties.

    Table 6. FindByProperty method parameters
    Parameter Description Data port type Data type Default value Mandatory?
    SearchText Text that the method searches in the list items. Data in String None Yes
    FindBy Option to indicate whether the method searches a text or regex. Data in String None Yes
    MatchType Option to indicate whether the type of match will be:
    • An exact match
    • Match case
    • Containing the specified characters.
    Data In String None Yes
    Count Returns the total occurrences of the match. Data out Integer Not applicable Not applicable
    Outlist Returns the list of matches. Data out List Not applicable Not applicable

    GetItem

    Returns a list item based on its index value.

    To provide inputs to the parameters, see Configure port properties.

    Table 7. GetItem method parameters
    Parameter Description Data port type Data type Default value Mandatory?
    Index Index value of the list item. Data in Integer None Yes
    Return Returns the list item. Data out Object Not applicable Not applicable

    GetItems

    Returns the list items based on their index values. You must configure the index values first.

    To configure, do the following steps.
    1. Click the method settings icon (Method settings icon.).
    2. Click the add index icon (Add index icon.).
    3. Enter the index value.
    4. Update the data type of the index value.
    5. Repeat the steps to add more index values.
    6. Click OK.

      A data out port is created with each index value. The data out port returns the list item corresponding to the index value.

    GetList

    Returns all list items and lists created.

    Table 8. GetList method parameters
    Parameter Description Data port type Data type Default value Mandatory?
    Return Returns the list items and lists. Data out Array None Not applicable

    Remove

    Removes the specified list item.

    To provide inputs to the parameters, see Configure port properties.

    Table 9. GetList method parameters
    Parameter Description Data port type Data type Default value Mandatory?
    Item List item the method removes. Data in Object None Yes

    RemoveAll

    Removes all list items added.

    Reverse

    Reverses the order of the index values of the list items.

    SetItems

    Updates the values of the list items. To use the method, you must first configure the method.

    To configure, do the following steps.
    1. Click the method settings icon (Method settings icon.).
    2. Click the add index icon (Add index icon.).
    3. Enter the index value.
    4. Update the data type of the index value.
    5. Repeat the steps to add more index values.
    6. Click OK.

      A data in port is created with each index value.

    To provide inputs to the parameters, see Configure port properties.

    Table 10. SetItems method parameters
    Parameter Description Data port type Data type Default value Mandatory?
    Item Accepts the value of the list items. Data in Object None Yes

    Sort

    Sorts the list items.

    ToArray

    Returns the list items in the form of an array. You must add more than one list item before executing this method.

    Table 11. ToArray method parameters
    Parameter Description Data port type Data type Default value Mandatory?
    Return Returns the list items in the form of an array list. Data out Array list Not applicable Not applicable