Action parameters

  • Release version: Yokohama
  • Updated January 30, 2025
  • 2 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 Action parameters

    Action parameters in ServiceNow define specific actions to be performed when JSON object parameters are included in HTTP GET or POST requests. They differ from data parameters by triggering operations such as querying, inserting, updating, or deleting records within targeted tables via the API. These parameters can be included directly in the JSON object or as URL parameters.

    Show full answer Show less

    Key Parameters and Their Functions

    • sysparmaction: Specifies the type of API action to execute. Common values include:
      • getKeys: Retrieves a comma-delimited list of sysid values matching a query.
      • getRecords: Retrieves all records and fields matching a query.
      • get: Retrieves a single record by sysid.
      • insert: Creates one or more new records.
      • insertMultiple: Creates multiple new records in bulk.
      • update: Updates existing records filtered by a query.
      • deleteRecord: Deletes a single record by sysid.
      • deleteMultiple: Deletes multiple records filtered by a query.
    • sysparmquery: An encoded query string used to filter records for actions like get, getRecords, update, or deleteMultiple.
    • sysparmview: Defines a form view to limit the fields returned in get or getRecords responses. If invalid or omitted, all active fields are returned.
    • sysparmsysid: Specifies the target record by sysid for get or deleteRecord actions.
    • sysparmrecordcount: Limits the number of records returned, constrained by the system property glide.processor.json.rowlimit.
    • displayvalue: Controls how reference fields display data:
      • true: Shows display values instead of sysids for all references.
      • false (default): Shows sysids only.
      • all: Shows both sysid and display value for reference fields.
    • displayvariables: When set to true on get or getRecords calls, retrieves all variables attached to the record.

    Practical Implications for ServiceNow Customers

    These action parameters empower customers to precisely control API interactions with ServiceNow tables, enabling efficient data retrieval and modification through REST calls. By leveraging parameters such as sysparmaction and sysparmquery, customers can execute targeted queries, updates, and deletions. The ability to customize returned data with sysparmview and control reference field outputs with displayvalue enhances integration flexibility and response optimization.

    Understanding and utilizing these parameters ensures streamlined automation, integration, and data management processes, reducing manual overhead and improving accuracy when interfacing programmatically with ServiceNow data.

    Action parameters are separate and different from data parameters because they specify the action to take when the JSON object parameter is part of an HTTP GET or POST request.

    The parameters can also be specified as a field in the supplied JSON object. They have the effect of triggering an action in the case of sysparm_action, or filtering the results of an update or query in the case of sysparm_query.

    sysparm_action

    The following are the valid values for sysparm_action and the corresponding action triggered by the API.
    Table 1. Data Retrieval
    Method Summary Description
    getKeys Query the targeted table using an encoded query string and return a comma delimited list of sys_id values.
    getRecords Query the targeted table using an encoded query string and return all matching records and their fields.
    get Query a single record from the targeted table by specifying the sys_id in the sysparm_sys_id URL parameter, and return the record and its fields.
    Table 2. Data Modification
    Method Summary Description
    insert Create one or more new records for the table targeted in the URL.
    insertMultiple Create multiple new records for the table targeted in the URL.
    update Update existing records in the targeted table in the URL, filtered by an encoded query string.
    deleteRecord Delete a record from the table targeted in the URL by specifying its sys_id in the sysparm_sys_id URL parameter.
    deleteMultiple Delete multiple records from the table targeted in the URL, filtered by an encoded query string.

    sysparm_query

    Specify an encoded query string to be used in get, getRecords, update or deleteMultiplesysparm_action value.

    sysparm_view

    Specify a form view to customize the return values for get and getRecords function calls. When using a view, the query returns only the fields defined in the view, including referenced values. If there is no view name, or if the view name is not valid, then the query returns all field names that are marked active in the dictionary.

    sysparm_sys_id

    Specify a target sys_id during a get or delete function call (sysparm_action value).

    sysparm_record_count

    Specify an integer value to limit the number of records retrieved for this request. Note that this value is capped by the glide.processor.json.row_limit system property.

    displayvalue

    Get the display value of a reference field, if any are in the record. For example, the Incident record can have an assigned_to field that is a reference to a user record. Instead of sending the sys_id of the user record, the user name is sent.

    The displayvalue parameter can have three values: true, false, or all.
    • true: All the references fields show the display value instead of sys_id.
    • false (default): All reference fields show sys_ids.
    • all: The display value and the sys_id are shown. For example, the assignedto field in the Incident record is sent back as assigned_to:1234556, dv_assigned_to:Fred Luddy.

    displayvariables

    Set this boolean value to true during a get or getRecords function call to retrieve all variables attached to this record.