User Tools

Site Tools


common_incident_to_salesforce

ServiceNow Common Incident Configuration

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

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

ServiceNow Installation and Configuration

Update Sets

To begin integrating SIAM for Salesforce 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 support@perspectium.com. 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 for Common Endpoint update set.
  3. Perspectium Common Document to integrate (ie. Common Incident, Common Change, etc.)


Subscribed Queue

In order to receive messages from Salesforce, we must create a subscribed queue. By default, MBS will push messages out to psp.out.servicenow.your_org_here. Below is an example of a subscribed queue for ServiceNow to Salesforce.

Creating a subscribed queue:

  1. Click on the subscribed queues link under the Replicator tab in the Perspectium App
  2. Create a table with a subscribed queue named psp.out.servicenow.your_org_here and fill in the respective credentials to the queue
  3. Click on “get queue status” and verify that it is active

Shared Queue

After creating the subscribed 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 psp.in.siam.client.salesforce and pass in the respective credentials to the queue
  3. Click on this “get queue status” and verify that it is active


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 for Salesforce (it will have been auto generated upon installing the update set) and the table name. Select the Target queue psp.in.siam.client.salesforce. See the dynamic share page for more information.

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

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

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

Outbound and Inbound Table Maps

The inbound table map will handle the conversion of Salesforce cases into ServiceNow incidents and the outbound table map will handle the conversion of ServiceNow incidents into Salesforce 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 maps ServiceNow incident field values to Salesforce cases. The images below are examples of the outbound table map for incident to common incident.

Transform Map

You will need to create the inbound transform map in ServiceNow that will convert the incoming fields and values from Salesforce.

  1. In ServiceNow, navigate to System Import Sets > Administration > Transform Maps to open the Table Maps form.
  2. Click New at the top left-hand corner of the Table Maps form.
  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 direct the values & 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. It will also set the state to “Ready” so that the message can be sent out.

(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 Packages.com.glide.util.StringUtil();
	ogr.addQuery("state", "deferred");
	ogr.addQuery("u_extra", 'CONTAINS', "number=" + source.u_number);
	ogr.queryNoDomain();

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

Below is the onAfter script that will share out updated tickets after being received.

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

Salesforce Configuration

Custom Case Field

After installing the Perspectium Salesforce Package and configuring your Salesforce org, it is necessary to create a custom field in your case table. This field will store the ServiceNow incident numbers when messages are sent over.

Navigate to “Setup” which will be towards the top right of the page

At the left side of the page, there is a side bar with a search function at the top. Type in “case” and there should be a Fields option under “Cases”

From here, you should now be in the Case Field page. Scroll down to the “Case Custom Fields and Relationships” section and select “New”

For step 1, scroll towards the bottom and select the “Text” option“ and click next.

For step 2, input your custom field's name into the Field Label. Field Name will automatically be generated

For step 3, give visibility permissions to the desired users. In this example, we will be granting everyone permission to view the custom field.

Finally, check the boxes for “Add Field” for “Case Layout” and “Close Case Layout” and press save

Queues

Navigate into the queues tab to create a share queue and a subscribed queue in order to exchange messages with ServiceNow.

Just like the ServiceNow share queue, point the Salesforce share queue to psp.in.siam.provider.salesforce

The queue name for the subscribed queue should be psp.out.salesforce.your_instance_number_here

Dynamic Share

A dynamic share table is necessary for records to be sent out upon creation, update, or deletion. Proceed to create a dynamic share and follow the examples below.

After saving the dynamic share, be sure to click “Save Trigger” afterwards

Inbound and Outbound Messages

You can see options for Inbound and Outbound Salesforce messageshere

common_incident_to_salesforce.txt · Last modified: 2018/09/10 11:19 by timothy.pike