Recordless SOAPMessageV2 example

reference brazil Updated Sep 10, 2026 1 min read r_RecordlessSOAPMessageV2Example.md
Raw file servicenow.com

You can use the SOAPMessageV2() constructor with no parameters to define a SOAP message entirely in the script.

When using this constructor you must provide an endpoint and SOAP action. In this example, the script creates an empty SOAP message and sets the values needed to insert an incident record.

JavaScript
var s = new sn_ws.SOAPMessageV2(); //create an empty SOAP messages.setBasicAuth('admin','admin');s.setSOAPAction('http://www.service-now.com/incident/insert'); //set the SOAP action to performs.setEndpoint('http://<instance>.service-now.com/incident.do?SOAP'); //set the web service provider endpoints.setRequestBody('<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:inc=\"http://www.service-now.com/incident\"><soapenv:Header/><soapenv:Body><inc:insert><short_description>Test Dynamic SOAP</short_description></inc:insert></soapenv:Body></soapenv:Envelope>');var response = s.execute();var xmldoc = new XMLDocument(response.getBody());var incident_sysid = xmldoc.getNodeText('//sys_id');

Parent Topic:Scripting outbound SOAP

Search documentation
Search document titles and file paths on the brazil branch