176 views

Description

ServiceNow provides Out of the box SOAP functionalities to perform CRUD operation on the records.

To retrieve a direct web service WSDL description and XML schema, point to the relative URL <tablename>.do?WSDL

The targeted resource (or table) is defined in the URL by the format https://<instance name>.service-now.com/<table name>.do.

Once the WSDL is imported , insert or update functions can be performed .

Once the insert or update is done, standard response is returned.
For example for insert operation sys_id is returned.
<insertResponse xmlns="http://www.service-now.com">
            <sys_id>6b06494fc611227d00b5f87caf618831</sys_id>
</insertResponse>

If a custom response is required with specific fields , this can achieved using Scripted SOAP web services

Instructions

1) create scripted soap service ,give a name
2) define input and output parameters

Attached screenshots for reference
Sample script below that take 3 inputs (sys_id,caller_id,short_description) , updates the "incident record" and sends 3 response output parameters (number,short_description,description) of the updated incident.
Input parameters are stored in the request object and output parameters are stored in response object

*********************
(function scriptedWebServiceOperation(request, response) {

// Add your code here
var sysid = request.sys_id;
var callerid = request.caller_id;
var shortDescription = request.short_description;
var gr = new GlideRecord("incident");
gr.get(sysid);
gr.caller_id = callerid ;
gr.short_description = shortDescription;
gr.update();
response.number = gr.number;
response.short_description = gr.short_description;
response.description = gr.description;

})(request, response);

*********************

Import the created WSDL and test .


NOTE: This is just a reference example . Scripting is beyond the scope of ServiceNow support . 




Article Information

Last Updated:2020-06-30 02:29:39
Published:2020-06-30