insertMultiple

  • 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 insertMultiple

    TheinsertMultiplemethod in ServiceNow allows customers to create multiple new records in a targeted table through a single SOAP API call. It enables batch insertion of records, improving efficiency when adding large volumes of data.

    Show full answer Show less

    This method supports up to 200 records per operation by default, with the option to gradually increase this number depending on your instance’s performance.

    Input Fields

    Each insertMultiple request contains one or more record elements. Each record includes fields relevant to the target table but excludes system fields. These fields define the data for each record you want to insert.

    Output Fields

    The response returns an insertMultipleResponse containing one or more record elements that provide details about each inserted record. The output format varies depending on the table type:

    • Regular tables: Returns the sysid and the display value (such as a record number) of each inserted record.
    • Import set tables: Returns the sysid of the import set row, the name of the transformed target table, display name and value of the transformed record, and a status indicating inserted, updated, or error. Optional fields like statusmessage or errormessage provide additional details if an error occurs.
    • Import sets with multiple transforms: Returns multiple sets of responses wrapped in a multiInsertResponse element, each linked to the corresponding transform map.

    Practical Use and Examples

    ServiceNow customers can use insertMultiple to efficiently bulk insert records such as incidents or import set rows. The documentation provides example SOAP envelopes showing how to format requests with multiple records and how the responses will appear for both regular tables and import sets.

    For example, inserting three incidents with only short descriptions specified will return their respective sysid and incident numbers, confirming successful creation.

    Why This Matters

    This method is essential for customers needing to automate or bulk-load data into ServiceNow tables while minimizing API calls and improving performance. Understanding the output allows for validation and error handling in integration workflows.

    Creates multiple new records for the table targeted in the URL.

    Input fields

    The insertMultiple element may contain 1 or more record tags that contains all fields from the targeted table, excluding system fields. Limit the number of records inserted in a single operation to no more than 200. You can gradually increase this number with subsequent exports if the increase does not negatively impact instance performance.

    Output fields

    The insertMultipleResponse tag is followed by 1 or more record tags that contains:

    Table 1. Insert method output fields
    Table type Output fields
    Regular The sys_id field and the display value of the target table (table) are returned.
    Import set

    The sys_id of the import set row, the name of the transformed target table (table), the display_name for the transformed target table, the display_value of the transformed target row, and a status field, which can contain inserted, updated, or error.

    There can be an optional status_message field or an error_message field value when status=error.

    When an insert did not cause a target row to be transformed (skipped because a key value is not specified), the sys_id field will contain the sys_id of the import set row, rather than the targeted transform table.

    Import set with multiple transforms The response from this type of insert will contain multiple sets of fields from the regular import set table insert wrapped in a multiInsertResponse parent element. Each set will contain a map field, showing which transform map created the response.

    Sample SOAP messages for a regular table

    The following example shows an insert that specifies the short description only:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inc="http://www.service-now.com/incident">
       <soapenv:Header/>
       <soapenv:Body>
          <inc:insertMultiple>
             <record>
                <short_description>this is test 1</short_description>
             </record>
             <record>
                <short_description>this is test 2</short_description>
             </record>
             <record>
                <short_description>this is test 3</short_description>
             </record>
          </inc:insertMultiple>
       </soapenv:Body>
    </soapenv:Envelope>

    The resulting response looks like this:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inc="http://www.service-now.com/incident">
       <soapenv:Header/>
       <soapenv:Body>
          <insertMultipleResponse>
             <insertResponse>
                <sys_id>168160ad4a36231200a89091281dc803</sys_id>
                <number>INC0055180</number>
             </insertResponse>
             <insertResponse>
                <sys_id>1681622e4a36231200a8909115e5c388</sys_id>
                <number>INC0055181</number>
             </insertResponse>
             <insertResponse>
                <sys_id>1681626e4a36231200a89091fa3c0aa8</sys_id>
                <number>INC0055182</number>
             </insertResponse>
          </insertMultipleResponse>
       </soapenv:Body>
    </soapenv:Envelope>

    Sample SOAP messages for an import set table

    The following example shows an insert that specifies the short description only:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:imp="http://www.service-now.com/imp_notification">
       <soapenv:Header/>
       <soapenv:Body>
          <imp:insertMultiple>:-->
             <imp:record>
                <imp:message>one</imp:message>
                <imp:uuid>a</imp:uuid>
             </imp:record>
             <imp:record>
                <imp:message>two</imp:message>
                <imp:uuid>b</imp:uuid>
             </imp:record>
             <imp:record>
                <imp:message>three</imp:message>
                <imp:uuid>c</imp:uuid>
             </imp:record>
          </imp:insertMultiple>
       </soapenv:Body>
    </soapenv:Envelope>

    The resulting response looks like this:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:imp="http://www.service-now.com/imp_notification">
       <soapenv:Header/>
       <soapenv:Body>
          <insertMultipleResponse>
             <insertResponse>
                <sys_id>1296b3ab0a0a0b5b73e966fbfab7acde</sys_id>
                <table>incident</table>
                <display_name>number</display_name>
                <display_value>INC0010033</display_value>
                <status>ignored</status>
                <status_message>No field values changed</status_message>
             </insertResponse>
             <insertResponse>
                <sys_id>1296b48e0a0a0b5b62513bb5974a7d96</sys_id>
                <table>incident</table>
                <display_name>number</display_name>
                <display_value>INC0010034</display_value>
                <status>ignored</status>
                <status_message>No field values changed</status_message>
             </insertResponse>
             <insertResponse>
                <sys_id>1296b58b0a0a0b5b468f534659538b9a</sys_id>
                <table>incident</table>
                <display_name>number</display_name>
                <display_value>INC0010035</display_value>
                <status>ignored</status>
                <status_message>No field values changed</status_message>
             </insertResponse>
          </insertMultipleResponse>
       </soapenv:Body>
    </soapenv:Envelope>