7/6/22, 6:34 PM Web Service Integration / Salesforce Integration - ServiceNow Helpdesk
Contents [hide]
1 What We learn from this post
2 Web Service Integration
3 ServiceNow provides various Inbound and Outbound web services:
3.1 Inbound web services allow you to access and modify ServiceNow data using a client
application.
3.2 Outbound web services allow you to send SOAP and REST messages to external web
service providers.
4 Watch For Live Demonstration
5 Web Service Integration
6 ServiceNow provides various Inbound and Outbound web services:
6.1 Inbound web services allow you to access and modify ServiceNow data using a client
application.
6.2 Outbound web services allow you to send SOAP and REST messages to external web
service providers.
What We learn from this post
Web Service Integration
HTTP-based web services integration allow diverse applications to talk to each other. ServiceNow
supports both inbound (provider) and outbound (consumer) web services.
ServiceNow supports multiple web service formats like csv, xml, excel, json, pdf, rest, rss, soap,
odbc etc.
Note: It is important to know that the tool which you are going to integrate with Servicenow
supports web service or not, if yes then what format?
ServiceNow provides various Inbound and Outbound web
services:
Inbound web services allow you to access and modify ServiceNow
data using a client application.
https://servicenowhelpdesk.com/web-service-integration/ 1/5
7/6/22, 6:34 PM Web Service Integration / Salesforce Integration - ServiceNow Helpdesk
Direct Web Services: query tables and records directly using SOAP, REST, or other web
service formats.
Import Set: access the import set tables and import data through a web service interface.
Scripted Web Services: define custom web service endpoints using JavaScript.
Outbound web services allow you to send SOAP and REST messages
to external web service providers.
Outbound REST
Outbound SOAP
Find below scripts which i have used in video.
Post Method code
// implement resource here
(function process( /RESTAPIRequest/ request, /RESTAPI
var params;
try {
params = request.body.data;
gs.info("My Incident API request body params = " +
} catch (e) {
gs.error("Error occured " + e.getMessage());
throw sn_ws_err.BadRequestError("malformed request
}
var myIncidentHandle = new MyIncident();
Script Include 1
var MyIncident = Class.create();
MyIncident.prototype = {
initialize: function() {},
createMyIncidentFromAPI: function(params, tableName)
var myIncGr = global.DaoUtils.prepareGlideRecord(
var tid = myIncGr.insert();
this.logger.info("DaoUtils : created My Incident t
return {
"sys_id": tid,
"number": myIncGr.getValue("number")
};
Script Include 2
https://servicenowhelpdesk.com/web-service-integration/ 2/5
7/6/22, 6:34 PM Web Service Integration / Salesforce Integration - ServiceNow Helpdesk
var DaoUtils = Class.create();
DaoUtils.prototype = {
initialize: function() {},
type: 'DaoUtils'
};
DaoUtils.prepareGlideRecord = function(params, tableN
var gr = new GlideRecordSecure(tableName);
gr.initialize();
for (var attr in gr) {
if (attr == "comments") {
gr.comments = params[attr];
} else if (params[attr]) {
gr.setValue(attr, params[attr]);
1. Will understand Web Service Integration. Like when and how we will use it.
2. Will talk about Inbound and Outbound web service.
3. Will talk about Inbound Import set and Scripted Rest APIs.
4. Will talk about Outbound Rest Message.
5. Will set up Inbound and Outbound in ServiceNow Instance to see live data exchange.
We will use Salesforce tool to consume the data.
Watch For Live Demonstration
Web Service Integration
HTTP-based web services integration allow diverse applications to talk to each other. ServiceNow
supports both inbound (provider) and outbound (consumer) web services.
https://servicenowhelpdesk.com/web-service-integration/ 3/5
7/6/22, 6:34 PM Web Service Integration / Salesforce Integration - ServiceNow Helpdesk
ServiceNow supports multiple web service formats like csv, xml, excel, json, pdf, rest, rss, soap,
odbc etc.
Note: It is important to know that the tool which you are going to integrate with Servicenow
supports web service or not, if yes then what format?
ServiceNow provides various Inbound and Outbound web
services:
Inbound web services allow you to access and modify ServiceNow
data using a client application.
Direct Web Services: query tables and records directly using SOAP, REST, or other web
service formats.
Import Set: access the import set tables and import data through a web service interface.
Scripted Web Services: define custom web service endpoints using JavaScript.
Outbound web services allow you to send SOAP and REST messages
to external web service providers.
Outbound REST
Outbound SOAP
Find below scripts which i have used in video.
Post Method code
// implement resource here
(function process( /RESTAPIRequest/ request, /RESTAPI
var params;
try {
params = request.body.data;
gs.info("My Incident API request body params = " +
} catch (e) {
gs.error("Error occured " + e.getMessage());
throw sn_ws_err.BadRequestError("malformed request
}
var myIncidentHandle = new MyIncident();
Script Include 1
var MyIncident = Class.create();
MyIncident.prototype = {
initialize: function() {},
createMyIncidentFromAPI: function(params, tableName)
https://servicenowhelpdesk.com/web-service-integration/ 4/5
7/6/22, 6:34 PM Web Service Integration / Salesforce Integration - ServiceNow Helpdesk
var myIncGr = global.DaoUtils.prepareGlideRecord(
var tid = myIncGr.insert();
this.logger.info("DaoUtils : created My Incident t
return {
"sys_id": tid,
"number": myIncGr.getValue("number")
Script Include 2
var DaoUtils = Class.create();
DaoUtils.prototype = {
initialize: function() {},
type: 'DaoUtils'
};
DaoUtils.prepareGlideRecord = function(params, tableN
var gr = new GlideRecordSecure(tableName);
gr.initialize();
for (var attr in gr) {
if (attr == "comments") {
gr.comments = params[attr];
} else if (params[attr]) {
gr.setValue(attr, params[attr]);
https://servicenowhelpdesk.com/web-service-integration/ 5/5