Code being added to HTML email templates after saving

Marcel H_
Tera Guru

I keep having an odd issue with HTML email templates that I've been working with, and wondering if anyone has ever seen anything like this.

I had my templates working well, except for some minor HTML formatting that I was tweaking, then all of a sudden the templates were loosing formatting, tables not formatted properly, etc. After looking at the code for the templates I noticed things like the following lines were being added to the code in seemingly random locations:

<span id="CmCaReT"></span>

<span id="__caret">_</span><!--

\u0

  (not inside any tags)

<p></p> (seemingly random, adding white space where there was none before, and not in an area in the editor or code that I changed)

<p>  </p> (added between lines where no spaces existed previously)

The other issue is that I'll go in and delete these added tags, save the template and check the code again and they'll be back. Sometimes it takes deleting the tags 5, 6, 7 times before the code will properly reflect what I want it to be.

It's truly maddening when you get everything looking the way you want in the email preview on the notification record, then test by generating records to trigger sending the mail, and have it come through completely messed up in the mail client.

12 REPLIES 12

Lucas Vieites
Tera Guru

This is a bug in the CodeMirror plugin in the TinyMCE editor (see bug #2009 on GitHub) which happens when you leave the cursor of the code editor inside the CSS code. The <span> tag will be inserted where you left the cursor.

Thanks, this "solved" our problem.

Chirag A
Kilo Expert

I faced the same issue last week and after multiple efforts ended with this successfull way to get rid off the "CmCaReT" span tag.

 

1) Take full HTML + CSS code into some local editor like notepad.

2) Remove those unwanted "CmCaReT" span tags; and make you necessary changes for all CSS / styles in notepad itself.

3) Copy full Code back to the Servicenow HTML editor. And save it.

This will not put the "CmCaReT" tags back in there.

 

Thanks

Chirag A

Snow Developer at Aavenir