Context

Acknowledgements are intended to function for ServiceNow to ServiceNow integrations with the Perspectium SIAM / Common Document format in mind. They are intended to relay back the ticket number to the originating instance for coalescing and display purposes. That way, when instance A opens up a ticket with instance B, they see that it was created on instance B with the number “INC1234”.

This is typically handled by sharing some form of the record back from instance B to instance A, and populating the correlation_id and correlation_display values on instance A with the corresponding sys_id and number from instance B. When the record is modified and shared back to the originating instance, this is the out of box behavior.

However, the automated acknowledge to do this is not the out of box behavior. It is not required for the replication to function under most circumstances. However, it can provide that notice that the other side created the ticket appropriately.

Implementation

This is handled via an additional onAfter Script used in your Inbound Transform Map. This script's job is to utilize the Perspectium Replicator to essentially share this record back out to the originating instance. There are a couple different ways to do this depending on how general you want your script to be, but the basic steps are as follows:

  1. Identify the Share configuration you want to route through

  2. Share out this record

Example

The following example will Share out the target record back to the originating instance when the incoming record is processed AND does not have a correlation id. In other words this is sent out on an insert into the system.

It will require you to replace sys_id of the dynamic share with the sys_id of the dynamic share you are using to send data back.

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
 
  if(source.sys_import_state != 'ignored' && source.sys_import_state != 'skipped' && source.u_correlation_id.nil()) {
    var pspR = new PerspectiumReplicator();
    pspR.shareRecord(target, target.getTableName(),'', **sys_id of the dynamic share**);
  }
 
 
})(source, map, log, target);

Additional Options

It is also possible to modify the script to make it more generic. You can have it perform a GlideRecord query to lookup the Dynamic Share with a Target Queue matching some name, and pass that in.

You may want to do that if you do not want or have the same Dynamic Share (by sys_id) across dev/qa/prod instances.