Create a new Script Action NOTE: Click here for the Perspectium Attachment script action XML. You can use the attached XML as a base, otherwise, follow the steps below.
Go to System Policy > Events > Script Actions. Click New. In the Event name field, select attachment.uploaded. Check the Active box. 
Then, input the following script in the Script field: NOTE: Replace <tag name> with the appropriate tag name and <shared queue> to the target queue you are using in the dynamic share.
pspShareUploaded();
function pspShareUploaded() {
var pspRepl = new PerspectiumReplicator();
var pspUtil = new PerspectiumUtil();
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 = "attach";
var qc = new GlideRecord('psp_replicate_conf');
qc.addQuery('table_name', tableName);
qc.addQuery('action_create', true);
qc.addQuery('action_update', true);
qc.addQuery('sync_direction', 'share');
qc.addQuery('active', 'true');
qc.addQuery('u_target_queue.u_name', '<shared queue>');
qc.query();
if(qc.next()) {
// share record, setting tag to mark attachments
if (tgr.operation() == "insert" || (tgr.isValidField("correlation_id") && tgr.correlation_id.nil())) {
op = "deferred";
}
var agr = new GlideRecord(event.table);
agr.addQuery("table_name", tableName);
agr.addQuery("table_sys_id", tableSysId);
agr.query();
while (agr.next()) {
if (!pspUtil.recordHasTag(agr, '<tag name>')) {
pspRepl.shareOneRecord(tgr, qc, tableName, op, '<tag name>');
}
}
}
} |
Click Submit when you are done. |