ServiceNow transform maps allow you to map data from an import set table (inbound data for ServiceNow) to fields in the appropriate ServiceNow tables. To ensure that data being shared out of Jira and into your ServiceNow instance is mapped to the proper fields, you will need to make some changes to the existing Common Incident to Incident for Jira transform map in your ServiceNow instance that will be used as the hub for your multi-app ServiceBond integration.


Procedure

To modify the Common Incident to Incident for Jira transform map in ServiceNow for your multi-app ServiceBond integration, follow these steps:


Access the PSP Common Incident to Incident for Jira transform map 

Log into your ServiceNow instance and navigate to Perspectium Common Documents PSP Common Transform Maps. Then, click into the Common Incident to Incident for Jira transform map.

Access field maps

Make sure that the Run business rules box is checked. Then, scroll down to the Field Maps tab. 

Add a new field map script for Sys ID

Click New to add a new field map. Check the Use source script and Coalesce boxes. Then select your target table and choose Sys Id as the target field. Add the following Source script for your new field map:

answer = (function transformEntry(source) {
    if (source.u_action == 'issue_created' || source.u_action == 'issue_updated') {
        var pspC = new PerspectiumCorrelation();
        return pspC.getRecordSysId(source, 'jira', 'incident');
    }
    return '';
})(source);

Finally, click Submit in the bottom left-hand corner of the form to save your new field map.

Add transform scripts

Scroll down and click the Transform Scripts tab. Then, create three new transform scripts by clicking New and adding the following specifications for each (Be sure to click Submit to save each new transform script):

When

Active checked?

Order

Script

onBeforeYes110
// Ignore applications other than Jira
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
if (!source.u_provider.toString().contains("jira")) {
ignore = true;
}
})(source, map, log, target);
onAfterYes90
// Update Correlation IDs in the Correlation table
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
    var projName = gs.getProperty('com.perspectium.siam.jira.project');
    if (source.u_correlation_display.toString().contains(projName)) {
        var pspC = new PerspectiumCorrelation();
        pspC.updateCorrelationRecord(target, source, 'jira');
    }
})(source, map, log, target);
onBeforeYes105
// Prevents duplication of comments
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

    if (source.u_comments.nil())
        return;
    var sgr = new GlideRecord("sys_journal_field");
    sgr.addQuery("name", target.getTableName());
    sgr.addQuery("element", "comments");
    sgr.addQuery("element_id", target.sys_id);
    sgr.addQuery("value", source.u_comments);
    sgr.query();
    if (sgr.next())
        ignore = true;

})(source, map, log, target);

Save the Common Incident to Incident for Jira transform map

Click Update in the top right-hand corner of the transform map form to save your changes to the Common Incident to Incident for Jira transform map.

Next steps


Copy and modify the Incident to Common Incident table map in ServiceNow (multi-app integration)