Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


HTML
<style>
.release-box {
	height: 30px; 
	width: 100px; 
	padding-top: 8px;
	text-align: center; 
	border-radius: 5px; 
	font-weight: bold; 
	background-color: #8efeb3;  
	border-color: #FCE28A;
}

.release-box:hover {
  	cursor: hand;
    cursor: pointer;
    opacity: .9; 
}
</style>
<meta name="robots" content="noindex">

<div class="release-box">
<a href="https://docs.perspectium.com/display/krypton" style="text-decoration: none; color: #FFFFFF; display: block;">
Krypton
</a>
</div>



To ensure that the data being shared out of Azure DevOps Zendesk and into ServiceNow (inbound data) is being mapped correctly when arriving at your ServiceNow instance,  you you will next need to add and update some of the scripts in the transform the transform maps under the PSP Common Transform Maps module. ServiceNow transform maps handle handle the format of data being shared into a ServiceNow instance. Making changes to the transform map scripts will allow data to be properly shared out of Azure DevOps of Zendesk and then be mapped correctly to the relevant fields in ServiceNow.


Procedure

To add and edit the transform map scripts for Azure DevOpsZendesk, follow these steps:


UI Steps


UI Step

Access the transform map

Log into your ServiceNow instance and navigate to Perspectium Common Documents > PSP Common Transform Maps or simply type and select Transform Maps in in the Filter Navigator on the upper left-hand side of the screen. Then, search for and then click into the transform map you are integrating.the following transform map:

TableTransform Map
Incident

PSP Common Incident to Incident

Change

PSP Common Change to Change



UI Step

Add and update field maps 

Scroll down to the list of Field Maps and search for and then click into assigned_to in the Target field

The transform maps comes with default mappings you can modify as needed. 

By default, Zendesk does not provide display names for user fields such as the person who was assigned a ticket. Instead, it will be mapped with their ID such as:

Code Block
languagexml
<assigned_to_name>7603423341591</assigned_to_name>

So in this case you will want to map this value in the field map to a corresponding value for a user in ServiceNow.

Click Update to save your changes.


UI Step

(Optional) Correlate when a Zendesk ticket is first created in ServiceNow

Since the transform map primarily handles corresponding actions in ServiceNow for actions initiated in Zendesk (i.e. when a user creates a ticket in Zendesk, the transform map will handle actually creating the ticket in ServiceNow after receiving it from the meshlet and MBS), ServiceNow can send back a .correlate message so Zendesk knows what the unique identifier (sys_id) of the record is in ServiceNow.

In this case, you would create an onAfter transform script in the PSP Common Incident to Incident transform map with the following code to send back the .correlate message that the meshlet can process into Zendesk and save into the Correlation ID custom field:  Check the Use source script checkbox, then add the following in the Source script:

Code Block
languagejs
answer = // Correlate sharing instance record
(function transformEntryrunTransformScript(source, map, log, target /*undefined onStart*/ ) {
	if var table_name = "incident";  // table being shared
	var queue_name = "psp.in.meshlet.zendesk.incident.instance_name"; // queue that meshlet reads messages from
	
	if(source.u_assigned_to_email.indexOf('<') == -1)correlation_id != ""){
		return;
	}
	
	var queueGR = new GlideRecord("u_psp_queues");
	var startIndexqueue = source.u_assigned_to_email.indexOf('<') + 1"";
	queueGR.addQuery("u_name", queue_name);
	queueGR.query();
	if (!queueGR.next()){
		return;
	}
	
	queue = queueGR.sys_id;
	var endIndexshareGR = new GlideRecord("psp_replicate_conf");
	shareGR.addQuery("table_name", table_name);
	shareGR.addQuery("u_target_queue", queue);
	shareGR.query();
	if (!shareGR.next()){
		return;
	}
	
	var tableGR = new GlideRecord(table_name);
	tableGR.addQuery("sys_id", target.sys_id);
	tableGR.query();
	if (tableGR.next()){
		var pspR = new PerspectiumReplicator();
		pspR.shareRecord(tableGR, table_name, "correlate", shareGR.sys_id);
	}
})(source, map, log, target);

(info) NOTE: By default the Zendesk meshlet will read any information in the <comments> field of the Common Incident sent back as part of the .correlate message when updating the Zendesk ticket with the ServiceNow sys_id. If you prefer to specify a default comment when no comments are entered, you can enter a default message to use in the defaultCorrelateResponse meshlet configuration.


UI Step

(Optional) Add a comment when a ticket is successfully created in Zendesk

When the  meshlet creates a new ticket in Zendesk, it will send back a .correlate message that ServiceNow can consume and add a comment to the incident. For example, you can create an onAfter transform script on the PSP Common Incident to Incident transform map with the following code to log the ID of the record as created in Zendesk:  

Code Block
languagejs
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

	// Add your code here
	if (source.u_action == 'correlate') {
		var igr = new GlideRecord('incident');
		igr.query('sys_id', source.u_correlation_id);
		if (igr source.u_assigned_to_email.indexOf('>');
	var email = source.u_assigned_to_email.substring(startIndex, endIndex);
	var sgr = new GlideRecord('sys_user');
	sgr.addNotNullQuery('email');
	sgr.addQuery('email', email);
	sgr.query();
	if (sgr.next()) {
			return sgr.igr.comments.setJournalEntry('Record successfully created in Zendesk with ID ' + source.u_sys_id);
			igr.update();
		}
	return "";
}
})(source);

Click Update to save your changes.

Image Removed
, map, log, target);