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

Tanaji Patil
Tera Guru

Hello Phonsie,

Could you please add your code here?

-Tanaji

Hi Tanaji,

The code is similar to the one at https://community.servicenow.com/community?id=community_question&sys_id=65a06eeedbba5f80b2102926ca961910

The issue is that the attachments are no longer on the sys_email table.

Kind regards,

Phonsie

I checked and I can see the attachment on sys_email table. We also have similar integration (its in application scope) and it seems to be working. We are also on New York Patch 4.
I see that there is now a new table Email Attachment [sys_email_attachment] which tracks all the attachments and action taken.

 

Could you check sys_attachment table to see on which table the attachment is?

 

-Tanaji

Please mark the responses correct/helpful if applicable.

Hi Tanaji,

The attachments were on both tables. The issue was that another (auto-reply) script was moving the attachments from the sys_email table to the auto-reply email record.

Kind regards,

Phonsie