Whilst importing XML formatted knowledge articles into Servicenow it was found that data inserted into HTML fields was being altered by the TinyMCE plugin upon record save.

The data contained both 'src' and 'data-mce-src' attributes, used to reference image locations.

Upon saving the record it was seen that the 'data-mce-src' attribute was being removed, and that the value for 'src' was being replaced with it.

This behaviour can be reproduced in an out of box (OOB) New York instance, as follows:

1. Log into an out of box New York instance that has TinyMCE editor enabled for HTML fields.
2. Navigate to sc_cat_item.do
3. Open the source code window for the 'Description' TinyMCE HTML field ('<>' icon in toolbar) and put following in:

<img src="/10off.png" data-mce-src="/10on.png">

4. Close the source code window - You will see that the '10off.png' image from the 'db_image' table is displayed within the field.
5. Re-open the source code and you will see that the code has now become:

<img src="/10on.png" />

The 'data-mce-src' attribute has been removed and 'src' is now the value that 'data-mce-src' was, resulting in a change to the displayed image.

Release or Environment

Any instance that utilises the TinyMCE editor in HTML Field types.


The 'data-mce-src' attribute is an internal one specific to the TinyMCE plugin, so it is not expected to be persisting to the database when you save a record.

That is it exists only in the DOM, and not when you open up the code plugin, hence why it disappears when you open up the code plugin again.

The 'src' and 'data-mce-src' attributes should also actually be the same, as they are added by TinyMCE itself when an image is inserted. The only way they might differ is if they have been manually added.

So in this regard the application was determined to be behaving as expected.


It was advised that the XML being imported be reviewed, using script to replace all references to 'data-mce-src' with some unidentifiable attribute name instead, so that upon import they would all be automatically removed without affecting the value of the 'src' attribute.

Article Information

Last Updated:2020-06-17 14:14:11