(function runTransformScript(source, map, log, target /*undefined onStart*/ ) { var pspS = new PerspectiumEncryption(); var pspR = new PerspectiumReplicator(); var ogr = new GlideRecord("psp_out_message"); ogr.addQuery("state", "deferred"); var orQc = ogr.addQuery("u_extra", "CONTAINS", "number=" + source.u_number); orQc.addOrCondition("u_attributes", "CONTAINS", target.sys_id); ogr.query(); while (ogr.next()) { // update value with correlation id before we send out var decodeData = pspS.decryptString(ogr.value); decodeData = decodeData.replace("<correlation_id/>", "<correlation_id>" + target.correlation_id + "</correlation_id>"); if (decodeData.indexOf("</attachments>") > -1) { ogr.name = ogr.name.replace("update", "attach"); } ogr.value = pspS.encryptStringWithCipher(decodeData, "3"); ogr.u_extra = ""; ogr.state = "ready"; ogr.update(); } })(source, map, log, target); |