GlideSysAttachment.copy not working in New York due to sys_email_attachment table

Phonsie Hevey1
Tera Expert

The standard code to copy attachments from an inbound email to a RITM i.e. GlideSysAttachment.copy('sys_email', emailRec.sys_id, 'sc_req_item', ritm.sys_id); doesn't seem to be working anymore in New York. There is a new table now Email Attachments [sys_email_attachment] where these records are stored. Has anyone else noticed this and come up with a solution? I'm looking at this at the moment but I think this is something that might go unnoticed during an upgrade and people should be aware of. The code above doesn't work as the attachment is no longer attached to the email record.

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hello,

I just tested this with a reply email (including attachment) from the email client within my personal developer instance. I'm on New York Patch 4.

So I went to Incident, sent email from email client, I received it, I wrote back and attached attachment, the instance received that email, processed it and placed the attachment on Incident record:

This is all that's in my inbound action script:

var gr = new GlideSysAttachment().copy('sys_email', sys_email.sys_id, 'incident', current.sys_id);

So you'd just want to change the table and current.sys_id to whatever is relevant for you.

Attachments are still working from sys_email.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

7 REPLIES 7

Allen Andreas
Administrator
Administrator

Hello,

I just tested this with a reply email (including attachment) from the email client within my personal developer instance. I'm on New York Patch 4.

So I went to Incident, sent email from email client, I received it, I wrote back and attached attachment, the instance received that email, processed it and placed the attachment on Incident record:

This is all that's in my inbound action script:

var gr = new GlideSysAttachment().copy('sys_email', sys_email.sys_id, 'incident', current.sys_id);

So you'd just want to change the table and current.sys_id to whatever is relevant for you.

Attachments are still working from sys_email.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Phonsie Hevey1
Tera Expert

Apologies, this seems to be working fine. The issue I was experiencing was that there's another script running in the system I'm working on which moves the attachments instead of copying them. So when I reprocessed the email the attachments were no longer attached to the sys_email record. I could see that they were still listed in the Email Attachments. I thought this was some new behaviour in the New York version, which doesn't seem to be the case, thankfully.

Thanks! I just got hung up on this same phenomenon.