User Tools

Site Tools


ServiceNow to OpsRamp Installation Configuration

The ServiceNow OpsRamp SIAM Integration allows for replication of processes between your ServiceNow and OpsRamp.

The following are steps to install and configure the various components to implement the OpsRamp SIAM integration for ServiceNow for the first time.

ServiceNow Installation and Configuration

1. Update Sets

To begin integrating SIAM for OpsRamp into your ServiceNow instance you must first install the Perspectium update sets. For the latest update sets, visit the Update Set Releases page and request the download links from For more information on installing or updating the update sets, visit the first time install or updating pages.

The update sets should be installed in this order:

  1. Perspectium for ServiceNow update set.
  2. Perspectium Common Doc to integrate (ie. Common Incident, Common Change, etc.)

2. Dynamic Share and Shared Queue

After creating the subscribe queue, we will next create a dynamic share and shared queue. Visit the Dynamic share and Shared Queues pages for general information on both of these features.

Creating a shared queue:

  1. Click on the shared queues link under the Replicator tab in the Perspectium App
  2. Create a table with a shared queue named and pass in the respective credentials to the queue
  3. Click on this Shared Queue and verify that it is active.
  4. Stay in this Shared Queues view to complete the Dynamic Share and Shared queue configuration.

To complete the configuration you will need:

  1. The SIAM endpoint url
  2. The Queue user for your SIAM endpoint.
  3. The Queue user password for your SIAM endpoint.

You will then need to enter this information into the Endpoint URL, Queue User, and Queue user password fields in the Shared queues. Once this is done click the update button in the top right of the shared queue view and these settings should be saved.

Creating Dynamic Shares

To create your own share for other tables click the Dynamic Shares module under the Perspectium application menu. Click the new button to move on to the dynamic share form. Select the desired table to share and select the active checkbox. Then choose your trigger conditions and move to the “Additional Settings” section of the form. Select the table map that contains OpsRamp and the table name. Select the Target queue See the dynamic share page for more information.

The following images are examples for configuring the ServiceNow incident table to share out to OpsRamp case object:

Below is the code for the “Before share script”:

if (psp_action == 'update' && current.correlation_id == ''){
	psp_action = 'deferred';

3. Outbound and Inbound table maps

The inbound table map will handle the conversion of OpsRamp cases into ServiceNow incidents and the outbound table map will handle the conversion of ServiceNow incidents into OpsRamp cases. Both table maps are key components for the SIAM integration. See table map page for more information.

Incident to Common Incident

The outbound table map requires specific fields to communicate from ServiceNow Incidents to the OpsRamp cases. For each new table, a table map with the required outbound table map fields are necessary. The “@” designates date to the attribute field instead of going directly to the common data format. Below is an example of creating the field value that points correlation_id to @EndPointUrlPath, which will create a EndPointUrlPath attribute when sending out a message. Add more fields if necessary.

The scripts used above are provided below:

correlation_id to @EndpointUrlPath:

answer = "";

if (current.correlation_id != "")
	answer = "/" + current.correlation_id;

answer += "?vtoken=your_token_here";

ProcessResponse to @ProcessResponse:

answer = "true";

To properly share attachments, add the field map as shown below

source field:



The psp_attachment table map below will map attachments into the <attachments> field when an incident message is shared out

Below is the script for the “data” field value:

var sysEncodedAttachment = new GlideSysAttachment();  
var binData = sysEncodedAttachment.getBytes(current);  
var StringUtil = (typeof GlideStringUtil != 'undefined') ? new GlideStringUtil() : new;
answer = StringUtil.base64Encode(binData);

Transform Map

Unlike the outbound table map, we will be creating the transform table map which will convert the incoming fields and values for ServiceNow.

  1. Navigate to transform maps under System Import Sets with the filter navigator bar at the top left
  2. We will be creating a new map, so select new at the top left
  3. Follow the example of the pictures below and add more fields if necessary

After creating and defining the field values, we need to add a few transform scripts so that ServiceNow will know how to handle, update, and where to direct values and attachments from received messages in the inbound table.

Below is the onAfter transform script that will update deferred messages to have the correct correlation id and vtoken and also set the state to “Ready” so that the message can be sent out

Below will share out updated tickets after being received

Below will attach attachments respectively, from OpsRamp to ServiceNow

Script for deferred messages and updating correlation id:

(function runTransformScript(source, map, log, target ) {
	var ogr = new GlideRecord("psp_out_message");
	var pspS = new PerspectiumEncryption();
	var StringUtil = (typeof GlideStringUtil != 'undefined') ? new GlideStringUtil() : new;
	ogr.addQuery("state", "deferred");
	ogr.addQuery("u_extra", 'CONTAINS', "number=" + source.u_number);

	while ( {
		var names = String(".");
		if (names.length != 2 || names[1] != "update"){
		var decodedValue = StringUtil.base64Decode(ogr.value);
		ogr.value = StringUtil.base64Encode(decodedValue.replace("<correlation_id/>", "<correlation_id>" + source.u_correlation_id + "</correlation_id>"));
		ogr.u_attributes = ogr.u_attributes.replace("EndpointUrlPath=/incidents", "EndpointUrlPath=/incidents/" + source.u_correlation_id);
		ogr.state = "ready";
})(source, map, log, target);

Script to share out updated tickets after being received:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
	if(source.u_number != ""){
	var qgr = new GlideRecord("u_psp_queues");
	var queue = "";
	qgr.addQuery("u_name", "");
	if (!{
	queue = qgr.sys_id;
	var qc = new GlideRecord("psp_replicate_conf");
	qc.addQuery("table_name", "incident");
	qc.addQuery("u_target_queue", qgr.sys_id);
	if (!{
	var gr = new GlideRecord("incident");
	gr.addQuery("sys_id", target.sys_id);
	if ({
		var pspR = new PerspectiumReplicator();
		pspR.shareRecord(gr, "incident", "update", qc.sys_id);
})(source, map, log, target);

Script for attachments:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
	var attachments = new PerspectiumAttachment();
	attachments.addAttachments(source, target, "opsramp_sent");
})(source, map, log, target);
servicenow_to_opsramp.txt · Last modified: 2018/05/04 16:33 by vinhn