Add the original email message as attachment to incident record

sbanc
Kilo Guru

Hi Everyone

I have a need for having the original, untouched email message from the inbound email action added as .msg or .eml to the inserted incident record.

I already searched the community but only found a way to add a HTML file to the record with the email body in it.

We need this, that our ITIL users can reply to the origin email with all the header details ect. of the original inbound email.

Does anyone have an idea to get this working?

By the way, I am not familiar with the attachmentcreator, since my coding know-how isn't on a high level.

Thank you in advance for any input!

Regards,

Simon

1 ACCEPTED SOLUTION

adrianherdan
Kilo Expert

Hello,

I've got a better solution for you if you like. A link that will show you the email along with pictures in a modal in the incident. Hope this helps!

Create a new UI Action on the Incident Table with the following code:

 

function clickPreview() {
// the following is what we have to do to make this client
// script work from a list and form, with today's code
var sysId = typeof rowSysId == 'undefined' ? gel('sys_uniqueValue').value : rowSysId;

var msg = getMessage("Preview Email");
var gr = new GlideRecord("sys_email");
gr.addQuery("instance", sysId);
gr.addQuery("mailbox", 'received');
gr.query();
if (gr.next()) {
var dd = new GlideModal("preview_email");
dd.setTitle(msg);
dd.setWidth(800);
dd.setPreference('sysparm_id', gr.sys_id);
dd.render();
} else {
alert("Email not found: " + sysId);
}
}

 

 

find_real_file.png

View solution in original post

5 REPLIES 5

John Lombardo
Tera Contributor

Adrian, your solution works well. Thanks for the code. I have a question though, the displayed email only shows the Body of the email. Is there a way to show the headers field as well?

Thanks,

John