Inbound Email Action:Attachments

Not applicable

I have created an inbound email rule that will search any subject or email body for an incident number, and update the ticket accordingly. If it does not find an existing incident, it creates a new one. This functionality works whether a watermark is on the message or not.

When these emails have attachments, the new incidents that are created get the attachment just fine, but the incidents that are updates are not getting the attachments on the mail.

Anyone have any ideas what I am missing?

8 REPLIES 8

gmoore1
Tera Expert

If you are using a query to retrieve the record that you update and are not using the current object, then that is your problem. Check the Wiki link below:

http://wiki.service-now.com/index.php?title=Inbound_Email_Actions#Attachments

I had a similar problem, but I was creating a new incident without using the current object to do it. I wrote the function below to associate the email with the new incident and copy any attachments to it as well.

function updateEmailAndCopyAttachments(emailId, destTable, destId) {
var em = new GlideRecord('sys_email');
em.addQuery('sys_id', emailId);
em.query();
if(em.next()) {
em.instance = current.sys_id;
em.update();
Packages.com.glide.ui.SysAttachment.copy ('sys_email', emailId, destTable, destId);
}
}


Not applicable

Thanks! I solved the issue last week, as you point out here, my issue was the wrong sys_id on the sys_email table. Now it works like a champ!

Thanks again!


ptr1
Kilo Contributor

I have created a triage holding place for inbound emails. One inbound action putting all email content into a triage table. If the email address is known in sys_user the incident is created from a business rule on the triage table.

The problem is that my triage record is not catching attachments. The wiki said that is should automatically but I find that is not true in my case. Ideas?

My inbound action looks like this....

current.u_to = email.to
current.u_direct = email.direct
current.u_from = email.from;
current.u_origemail = email.origemail;
current.u_subject = email.subject;
current.u_body_text = "Subject: ";
current.u_body_text += email.subject;
current.u_body_text += "\n";
current.u_body_text += email.body_text;
current.u_body = email.body;
current.u_copied = email.copied
current.u_recipients = email.recipients
current.u_recipients_array = email.recipients_array
current.u_triage_status = "Open"

current.insert();


Hi All
How do I get the sys_id of the email being processed by my Inbound Action? I'm referencing to emailId variable in gmoore's function updateEmailAndCopyAttachments(emailId, destTable, destId)