insert

Creates a new record for the table targeted in the URL.

Input fields

All fields from the targeted table, excluding system fields. Fields configured as mandatory in the System Dictionary are reflected in the WSDL with the attribute minOccurs=1.

Output fields

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:

<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope xmlns:tns="http://www.service-now.com/incident" 
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
  xmlns:m="http://www.service-now.com"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <insert xmlns="http://www.service-now.com">
            <short_description xsi:type="xsd:string">This is a test</short_description>
        </insert>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The resulting response looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:m="http://www.service-now.com" 
  xmlns:tns="http://www.service-now.com/incident" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Body>
        <insertResponse xmlns="http://www.service-now.com">
            <sys_id>6b06494fc611227d00b5f87caf618831</sys_id>
        </insertResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Language-specific sample messages

For language-specific insert samples, refer to the following topics:

Perl SOAP::Lite

Java Apache Axis2

Microsoft .NET

Python