HTML code in a client template mail script is visible before sending the email - options?

scottatah
Giga Expert

I'm using a Client Template email on the Incident table to allow ITIL users to send an email from the ticket to whomever they please.   In the body of the email, I want to include the below mail script to always include the ticket # and description.   Problem is, we always bold our field names.   I'm by no means a coder and thus looking for some help.

 

The mail script looks like such:

 

<mail_script>

template.print("<B>Incident number: </B>" + current.number + "\n <B>Description:</B>\n" + current.description + "\n");

</mail_script>

 

When a user clicks the envelope icon on the incident form to send the email they get:

 

<B>Incident number: </B>INC0011007

<B>Description:</B>

The ServiceNow email client enables you to send email directly from any record (such as an incident, change request, problem, or user record). By default, this functionality is disabled. Administrators can enable the functionality by changing the dictionary entry for each appropriate application.

 

The received email looks like:


Incident number: INC0011007
Description:
The ServiceNow email client enables you to send email directly from any record (such as an incident, change request, problem, or user record). By default, this functionality is disabled. Administrators can enable the functionality by changing the dictionary entry for each appropriate application.

I am happy with the outcome, but I know the HTML code will throw ITIL users for a loop.   Is there a smart way I can hide it, or a way I can say DO NOT DELETE ANYTHING BELOW without having those comments show up in the final email?


Thanks for any advice or suggestions.

1 ACCEPTED SOLUTION

uluerje
Mega Expert

Hi Scott,


You need to change the sys_email.body type to HTML.



1. Go to the Dictionary, search for the sys_email table and select the record where Column name = body


sys_email.png


2. Change the 'Type' to HTML


body.png



This should fix your issue.


View solution in original post

3 REPLIES 3

uluerje
Mega Expert

Hi Scott,


You need to change the sys_email.body type to HTML.



1. Go to the Dictionary, search for the sys_email table and select the record where Column name = body


sys_email.png


2. Change the 'Type' to HTML


body.png



This should fix your issue.


That did resolve it.   I had no idea such a thing existed.   This is much easier than the road I was going down!   Much appreciated.



Now I'm just trying to figure out if this could negatively affect anything else.   In theory, all it's doing is displaying content in the body column of the sys_email table in HTML format as opposed to string.   So, apart from potentially not showing the HTML coding, there's no possible negative side-effect of this.   Correct?


There are a couple known issues when the body is HTML.   You can read about them in the comments section of the guru post below.   Apparently they're working to fix these issues, and there are workarounds for most, if not all.   » How to Configure HTML-formatted Email Client Message Text in ServiceNow