Displaying images from emails inline, not as an attachment.

richard_selby
Kilo Guru

Most of our support enquiries arrive by email, and are viewed by the support staff in the Activity Log section.
This works fine when the email is mostly plain text, bar a corporate logo. But some clients send us notifications in the form of a pretty diary of planned outages rendered by a graphic designer.
ServiceNow strips off the attachment and requires the user to click a link up the top of the screen.

Is there anyway we can get ServiceNow to display png/jpg attachments inline with the text on the activity journal?

A related problem is HTML table data in emails. All HTML is stripped. Is this configurable?

27 REPLIES 27

hartr
Giga Contributor

Did you get an answer to this ? I'm having the same issue..


richard_selby
Kilo Guru

No, nobody was able to help out. So if any SN gurus out there know if you can display images inline in the Activity Log, do let on!


eican
Kilo Guru

Hi,

Fixing the images to be displayed is possible but it has one rather huge obstacle.
The basic setup would be to create a business rule or adding some code to the processing inbound email action which then are checking the HTML-body for an IMG-tag and corrects the SRC-attribute.
I just did that manually and then the image shows up just right (also in the activity log).

The obstacle though is:
If the email has more than 1 image attached, how do you know which image is referenced by which SRC-attribute?
Looking at the HTML code of the email body, the image is referenced as something like: "cid:359122619@21052013-32B6"
Checking the email header you can find a list of all attachments but in a short amount of time I wasn't able to find a reference which of the attachments is meant by "cid:359122619@21052013-32B6".

Automating this part is key. If you can manage to match the reference of the SRC-attribute with the list of attachments of the email (to figure out which is the correct image to be displayed where) the issue is fixed.
You can do it in a manual manner which creates a lot of manual work checking each inbound email with an attachment.

Still, the image would remain as an attachment of the resulting task-record (let's say incident). Only way to overcome this would be to move it from sys_attachment to image_db with a script.


Regarding your second question that all HTML is stripped out upon ticket creation:
The text-version of the email body is out-of-box copied into the description field which (by default) is not displaying HTML content but text only.
Also when looking at the activity log, all fields which are not of type "journal" do currently not display any HTML formatting but the HTML-code.
But when look at the email entry, you can still see the complete email in its formatting within the activity log. There were some issues but we're now running Berlin Patch 8 and everything is good. (My users had the same issue of receiving HTML formatted tables and that is our current implementation.

Having said the above, there is a way around:
You can change the type of the field "description" to be an HTML field (but watch out: this will affect all modules which are based on "task" - e.g. incident, problem, change, etc.).
Then simply change the line in your inbound email action which says:



current.description = email.body_text;
to


current.description = email.body_html;


and you will get the HTML formatted version of the email in your description field and also displayed properly.
Still, when looking at the activity log you will see the "raw" HTML code of that field as currently the activity log doesn't render HTML code in any field unless it is of type "journal".

As a workaround you could leave the description field and the code as is but add a line to copy the body of an email into the "comments"-field which then would also be correctly displayed in the activity log.

Hope this helps. If anyone would like to cooperate to create a solution for fixing the images in the emails, I would be more than happy to be part of it.
Eican


richard_selby
Kilo Guru

Thanks for taking the time to outline your thoughts on this. It's clear that I am not alone with these issues, and in order to get SN to do something not to advanced (display graphics and tables from emails in line) one has to jump through very hoops, and lots of them.

Keyvan and others in SN - are there any plans to make this easier for users?