Email attachment not getting attached with inbound action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 05:19 PM
Hi all,
I have an inbound action where it was initially sent from the ticket but the receiver fwd it back to us, the below inbound action picks that up and adds it to the initial ticket, however the attachment is not getting attach, i am using the GlideSysAttachment.copy function but it does not attach the attachment.
gs.include('validators');
var grEmailWatermark = new GlideRecord('sys_watermark');
grEmailWatermark.addQuery("number", email.body.ref);
grEmailWatermark.query();
if (grEmailWatermark.next()) {
var vSourceID = grEmailWatermark.source_id;
var grSctask = new GlideRecord('sc_task');
grSctask.addQuery("sys_id", vSourceID);
grSctask.query();
if (grSctask.next()) {
grSctask.work_notes = "Forward from: " + email.origemail + "\n\n" + email.body_text;
GlideSysAttachment.copy("sys_email", current.sys_id, current.target_table, current.instance);
grSctask.update();
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 06:02 PM
Hi,
It should have attached automatically without explicitly using GlideSysAttachment.copy as you are attaching attachment on the target record that got updated by inbound action. Have you tried without that?
If that doesn't work then update as below
GlideSysAttachment.copy("sys_email", current.sys_id, "sc_task", gr.getValue("sys_id"));
Thanks & Regards,
Sharjeel
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 09:44 PM
Hi Muhammad,
No its not attaching automatically, that's what i was thinking but it did not so i have to now look at the solution. I added the updated line that you provided - that did not add the attachment too.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2020 01:16 AM
Hi Sam,
Have you placed any logs? Where the code is broken?
I think current.sys_id must be replaced with current.table_sys_id
GlideSysAttachment.copy("sys_email", current.table_sys_id, 'sc_task', grSctask.sys_id);
Let me if you face any issues.
Thanks,
Sharjeel
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 10:29 PM
Ideally it automatically does this, can you please check in email logs if the attachment is being recieved from the end user.
Also is the record being inserted? Also by any chance any edit ACL access on the attachment table to the user or the record itself, check this too once.
I suggest to raise a Ticket to Hi then implement the customization of copying the attachments as suggested by our expert Muhammad above.
Thanks,
Saji