HTML-formatted Email Client Message Text

///HTML-formatted Email Client Message Text

HTML-formatted Email Client Message Text

T

he ServiceNow email client is a great way to allow technicians to send ad-hoc email notifications from within ticket and other forms. One common request I’ve seen for the email client is to allow the creation of html-formatted messages. Of course, it’s possible to manually code the HTML, but it’s much easier with a WYSIWYG editor to help with code generation and formatting.

In this post, I’ll show you a technique that Valor Poland shared with me a year or so ago that changes the email client ‘Message Text’ field to an HTML-based field for this purpose.

HTML Email Client

The solution here is actually very simple…if you know where to look. As an ‘admin’ user, simply navigate to ‘System Logs – Emails’ and open an email log form. Once there, right-click the ‘Body’ field and select ‘Personalize – Dictionary’. Finally, change the field ‘Type’ value to ‘html’ and update the dictionary record.

Email Log HTML Type

The ‘Body’ field on the email log table is actually shared between the email log and email client forms. Now that you’ve updated the field type to html, you should see this change reflected in your email client form as well!

By | 2018-07-09T14:59:53-06:00 December 12th, 2012|Categories: Email Notifications|Tags: |14 Comments

About the Author:

14 Comments

  1. Sekai Ko February 28, 2013 at 5:54 am - Reply

    Hi,

    This works great for us and helped when we had issues with the email client stripping out formatting after an upgrade to Berlin.The only problem is around using images directly into the body of the email. They can be uploaded or attached and look great. Even in the email logs in preview mode. However recipients don’t receive them. You just get a red cross in Outlook when the email is received.

    Any workarounds for this other than attaching in the usual email client way.

    SK

    • Mark Stanger February 28, 2013 at 6:10 am - Reply

      I’m glad to hear it’s helping! I don’t know of any other workarounds to your problem but I’ll be sure to post here if I find something.

      • Mike Zachary February 19, 2014 at 8:04 am - Reply

        When embedding images in the HTML-formatted email templates, you can not use local (local to your ServiceNow instance) images. This is because your mail client won’t have access to the image once it leaves ServiceNow. I’ve found it works just fine if you embed and HTML image reference to a publicly available image. For instance, edit the HTML of your email message template and embed something like this…

  2. Phil Taylor March 7, 2013 at 10:06 am - Reply

    Another issue with using the HTML format is that for each line it’s putting a break instead of So the email comes in with big spaces between each line. Is there anyways to fix this?

    • John LaGuardia March 27, 2013 at 10:16 pm - Reply

      Phil – we are also having the same break issue where branded email notifications end up with big spaces after they are sent. Have you found a solution to this one? Thanks for the help.

  3. David Field June 5, 2013 at 2:56 am - Reply

    I’m seeing Warning messages in the log since enabling this of the form;

    org.mozilla.javascript.EcmaError: “__ref_string__” is not defined.
    Caused by error in at line 1

    ==> 1: __ref_string__

    Twice for each use of the Email Client.

    Any pointers as to where I could look for the cause?

    • Mark Stanger June 5, 2013 at 7:06 am - Reply

      Will probably need to contact support on that one. I can reproduce it in the demo instance as well. Changing the field type to HTML shouldn’t have that type of effect.

      • David September 9, 2013 at 10:17 am - Reply

        Do you guys have any update on this matter? I really need to use the email client body as HTML but when receiving the email everything looks spaced out and gigantic.

        I keep seeing this error in the logs:
        org.mozilla.javascript.EcmaError: “__ref_string__” is not defined.
        Caused by error in at line 1

        ==> 1: __ref_string__

  4. David Field June 5, 2013 at 7:07 am - Reply

    Booked, I’ll feedback when I know something

  5. Petr Pastuszek July 29, 2013 at 4:38 am - Reply

    Hi!

    I wanted also confirm that we face the same issue.
    After field is changed to HTML and message sent out from incident record, picture is not displayed in receiver outlook(it display as red cross image) and also empty row is generated in the body of the received email between every text line . (I guess this second isssue double spaces, could be solved by some cleaning script which will remove the spaces before sending email out ????)

    Have some of you found route cause of this behavior please ?
    Thank you
    Petr

  6. Jim Uomini October 7, 2013 at 10:49 am - Reply

    I found out about an unintended consequence of using the HTML setting recently when implementing Knowledge. I wanted to use the Email Navigation Add-on to send article links to clients but found that no matter how I formatted my links in the email client template, the instance name was removed from the message that was sent out. After some suggestions on the community, a conversation with my local SE, and a lot of digging by the Help Desk, the only difference between my instance and OOB they could find was that my email client was using the Tiny MCE HTML editor. As soon as we switched back to plain text, the complete URLs were sent out. Not sure if this is a feature or a bug, but I’ve had to revert for now.

    I’m curious to hear Mark’s feedback.

    Jim

    • Mark Stanger October 7, 2013 at 12:03 pm - Reply

      Hey Jim,

      I’m sorry to hear that this didn’t work for you. I’m not sure what to say on this one, but if the url is stripped there, it is probably stripped anytime you use the HTML editor. In fact, I’ve seen a similar issue before with images embedded in a KB article that was sent from the system. The links break the same way there as well. This seems to me like an issue that ServiceNow should address.

  7. Brendan Wilson March 15, 2017 at 5:38 am - Reply

    Hi Mark

    Have you ever had any solution for the email client to update how many times its been sent? For example, its clicked first, subject would say Update#1, then if it was clicked again, would say #2 and so on?

    • Mark Stanger March 15, 2017 at 4:57 pm - Reply

      I haven’t ever seen that before. If you were going to do that you would probably need to keep the count stored in some background field on the form or something and then use a client script with GlideAjax to keep track of the number of times it was used. Probably not super easy to handle since the email client doesn’t offer a ton of flexibility.

Leave A Comment