Update the Perspectium synchronize Jira attachment script actionClick into the Perspectium synchronize Jira attachment script action with an event name of attachment.uploaded. Then, update the script as follows: pspShareJiraUploaded(); function pspShareJiraUploaded() { var pspRepl = new PerspectiumReplicator(); var pspCor = new PerspectiumCorrelation();
var tableName = event.parm1; var tableSysId = event.parm2;
var tgr = new GlideRecord(tableName); tgr.addQuery('sys_id', tableSysId); tgr.queryNoDomain(); if (!tgr.next()) { return; }
var op = "update";
var cgr = pspCor.getCorrelationRecord(tgr, '', 'jira'); if (tgr.operation() == "insert" || cgr == null || (cgr && cgr.u_correlation_id == '')) { op = "deferred"; }
var tUtils = new TableUtils(tableName); var tables = tUtils.getTables().toString(); var tableStr = tables.substring(1, tables.length() - 1);
var qc = new GlideRecord('psp_replicate_conf'); qc.addQuery('table_name','IN', tableStr); qc.addQuery("sync_direction", "share"); qc.addQuery("active", "true"); qc.addQuery("u_target_queue.u_name", "psp.in.siam.client.jira"); qc.query(); while(qc.next()) { // reset the message set counter each time we do a new share configuration pspRepl.messageSetCounter = {};
var startedDateTime = gs.nowDateTime(); // share record, setting tag to mark attachments pspRepl.shareOneRecord(tgr, qc, tableName, op, 'jira_sent'); var finishedDateTime = gs.nowDateTime();
// send message set for each share configuration we send attachments for pspRepl.pspMS.createMessageSetProcessed(pspRepl.messageSetCounter, qc, pspRepl.getKey(qc), startedDateTime, finishedDateTime); } }
|
Then, click Update in the bottom left-hand corner of the form to save the changes to this script action. |