insertMultiple
Summarize
Summary of insertMultiple
TheinsertMultipleoperation in ServiceNow enables customers to create multiple new records in a targeted table through a single API call. This method improves efficiency by allowing batch insertion of records, reducing the need for multiple individual insert requests.
Show less
It supports inserting up to 200 records in one operation, with the option to increase this number cautiously based on your instance’s performance.
Input Structure
The input to insertMultiple consists of one or more record elements containing fields from the target table (excluding system fields). Each record represents a separate record to be inserted.
Output Structure
The response includes an insertMultipleResponse element with one or more insertResponse child elements. The exact output fields depend on the table type:
- Regular Tables: Returns
sysidand the display value of the new record. - Import Set Tables: Returns
sysidof the import set row, the target table name, display name and value, and astatusfield indicating whether the record wasinserted,updated, or encountered anerror. Optional fields may includestatusmessageorerrormessage. - Import Sets with Multiple Transforms: Returns multiple sets of insert results wrapped in a
multiInsertResponseelement, including mapping information for each transform map applied.
Practical Use and Examples
Customers can use insertMultiple via SOAP messages by specifying multiple record entries within the insertMultiple element. For example, inserting several incidents by providing their short descriptions in separate record elements.
The response returns the identifiers and relevant display fields for each inserted record, confirming successful creation or providing details on errors or ignored records (especially in import set scenarios).
Key Considerations
- Limit batch inserts to no more than 200 records per call to avoid impacting instance performance.
- System fields cannot be included in the input records.
- Import set inserts provide detailed status feedback, allowing customers to track which records were inserted, updated, or skipped.
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 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 ( There can be an optional status_message field or an error_message field value when 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>