ServiceNow

Integration for Ticketing and CMDB

Prerequisites:

ServiceNow provides many modules and features for IT operations and within that CloudFabrix AIOPs platform integrates with Ticketing and CMDB modules.

ServiceNow integration is an out of the box in bi-directional way feature by using both APIs and REST message notifications.

This document explains step by step on how to integrate CloudFabrix AIOps platform with ServiceNow.

Create ServiceNow User for API access:

Step 1: Login to ServiceNow instane portal with an user account which has enough privileges to create a new user and assign required permissions.

Step 2: Click on 'User Administration'

Step 3: Click on 'Users' and Click on 'New' to create a new user.

Step 4: Enter username under 'User ID', and fill in the details as shown in the below screen. Please make sure to select 'Web service access only' as this user account is only for API integration.

Step 5: After creating the user in the above step, edit the user settings to assign appropriate roles and permissions for ServiceNow ticket management and CMDB data read-only access.

Step 6: Under 'Collection', search for the highlighted roles and add them to the 'Roles List' as shown in the below screen and click on 'Save'

Notes: Make sure 'Allow access to this table via web services' option is selected under 'Tables' section of ServiceNow for incident, incident task, change_request and applicable CMDB tables.

Configure ServiceNow integration in CloudFabrix AIOps:

Step 1: Login into CloudFabrix AIOps UI as an project admin user.

Step 2: Click on 'Ops Intelligence & Analytics' application.

Step 3: Select 'Configure Project' as shown in the below screen.

Step 4: Click on 'Datasources' on left menu and click on + to add ServiceNow API integration account.

Step 5: Enter 'Datasource Name' , 'Description' and select 'ServiceNow' under 'Select Datastore Type' list.

Under 'Domain' enter ServiceNow instance URL as shown in the screen. Enter 'Username', 'Password' and click on 'Test Connectivity'. Once successful, click on 'Save' to save the configuration.

Create Webhook Target for cfxOIA

cfxOIA can ingest and also push the incidents and its status. In order to make the bi-directional flow, both source and target endpoints needs to be created for Incidents.

Step 1: Login to cfxDimensions through web-browser UI (as Project Admin user)

Step 2: Click on ‘OIA (Ops Intelligence & Analytics)’ application.

Step 3: On context menu of existing Project, click on 'Configure Project'.

Step 4: Click on Incidents.

Step 5: Click on '+' to add new Incident Endpoint.

Step 6: Select Endpoint Role as 'Target' and enter Name and Description.

Step 7: Select 'Default ServiceNow Ticket' as Event Type.

Step 8: Select 'MACAW Notification' as Endpoint type.

Step 9: Enter 'NEW_TICKETS' as Notification ID.

Step 10: Click 'Save'

Step 11: On the context menu of newly created target incident endpoint, click on 'Enable' to activate the target.

Configure ServiceNow SaaS for Outbound Incidents

Step 1: Login to SNOW instance (ServiceNow Instance)

Step 2: Create Rest Outbound by search Rest message.

Step 3: Enter the webhook url and authentication details

Step 4: Create "POST" request and define variables, POST, endpoint and authentication.

Step 5: Define JSON message structure using the variable defined. Here, we are sending the entire JSON to the webhook.

Step 6: Go to System and click on 'Business Rule'

Step 7: Create new business rule. Define 'When to Run'

Step 8: Define "Actions"

Step 9: Define "Advanced"

Step 10: Sample Code is given for your reference

var JSONG = Class.create();
JSONG.prototype = Object.extendsObject(JSON, {
encodeGr : function(o) {
var a = ["{"], b, i, v;
for (i in o) {
if(o.hasOwnProperty(i)) {
v = o[i].toString();
switch (typeof v) {
case "undefined":
case "function":
case "unknown":
break;
default:
if (b) {
a.push(',');
}
a.push(this.encode(i), ":", v === null ? "null" : this.encode(v));
b = true;
}
}
}
a.push("}");
return a.join("");
}
});
(function executeRule(current, previous /*null when async*/) {
var r = new sn_ws.RESTMessageV2('CFX-SVCNOW-WEBHOOK', 'post');
var parser = new JSONG();
var data = parser.encodeGr(current);
r.setRequestBody(data);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
})(current, previous);

Step 11: Update / Create an incident and check on CloudFabrix side and check if the incident is created in the incidents UI on cfxOIA