HTML |
---|
<style>
.release-box {
height: 30px;
width: 100px;
padding-top: 8px;
text-align: center;
border-radius: 5px;
font-weight: bold;
background-color: #d4af37;
border-color: #FCE28A;
}
.release-box:hover {
cursor: hand;
cursor: pointer;
opacity: .9;
}
</style>
<meta name="robots" content="noindex">
<div class="release-box">
<a href="https://docs.perspectium.com/display/gold" style="text-decoration: none; color: #FFFFFF; display: block;">
Gold
</a>
</div> |
Before you submit your newly created incident, you may have added multiple attachments. But in some Service Integrations, it can only process one attachments at a time. In Service Integration meshlets, since Jackson’s XML parser does not work with repeated elements, it also can only process one attachment at a time.
Procedure
To start sending attachments individually, follow these steps:
UI Steps |
---|
UI Step |
---|
Access Dynamic ShareIn your ServiceNow instance, go to Perspectium > Replicator > Dynamic Share. Click the dynamic share you are using for your integration. Then, set the Business Rule Order to before. ![](/download/attachments/28935426/Attachment_before_rule.png?version=1&modificationDate=1601342626000&api=v2&effects=border-simple,blur-border)
|
UI Step |
---|
Set a Before Share ScriptAdd the following to the Before Share Script and replace the <tag_name> with the appropriate tag name and <dynamic_share_sys_id> with the dynamic share sys_id: Code Block |
---|
| if (psp_action == "insert") {
var pspA = new PerspectiumAttachment();
pspA.sendIndividualAttachments(current, "deferred", <tag_name>, <dynamic_share_sys_id>);
} |
![tinymce.emotions_dlg.information](https://docs.perspectium.com/s/en_US/8100/4410012ac87e845516b70bc69b6f7a893eabaa5a/6.15.2/_/images/icons/emoticons/information.svg) NOTE:
- If you update a record with multiple attachments, the first attachment will be inside the insert message while other attachments are in their separated messages.
- Due to ServiceNow limitations, attaching multiple attachments on an insert will only send out one attachment.
|
UI Step |
---|
Access Table MapAccess the table map for your integration by going to Perspectium Common Documents > PSP Common Table Maps. In the related list towards the bottom of the form, search for the record with a target field set to attachments.![](/download/attachments/28935426/Attachment_source_field.png?version=1&modificationDate=1601342626000&api=v2&effects=border-simple,blur-border) Then, replace <tag name> with the appropriate tag name. Code Block |
---|
| ${TM:psp_attachment;table_sys_id=$[GR:sys_id];<tag name>;skip_insert;limit 1} |
|
UI Step |
---|
Access the transform map for your integration by going to Perspectium Common Documents > PSP Common Transform Maps. In the Transform Script tab, look for the transform script starting with: Code Block |
---|
//onAfter for undeferring outbound messages, inactive by default |
Then, add the following script: Code Block |
---|
if (decodeData.indexOf("</attachments>") > -1) {
outGR.name = outGR.name.replace("update", "attach");
} |
See the following example: ![](/download/attachments/28935426/Attachment_transform_map.png?version=1&modificationDate=1601342626000&api=v2&effects=border-simple,blur-border)
|
UI Step |
---|
Create a new Script ActionGo to System Policy > Events > Script Actions. Click New. In the Event name field, select attachment.uploaded. Check the Active box. ![](/download/attachments/28935426/Attachment_script_action.png?version=1&modificationDate=1601342626000&api=v2&effects=border-simple,blur-border)
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.
Code Block |
---|
| 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. |
|
Similar topics
Content by Label |
---|
showLabels | false |
---|
max | 5 |
---|
showSpace | false |
---|
sort | modified |
---|
cql | label = "meshlet" and space = currentSpace() |
---|
|
support@perspectiumcom