- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2015 10:00 AM
Our management and user base wants to be able to insert inline images into Additional Comments and work notes and have them display correctly in the journal (Activity log). This is something that our previous system did well and which is missing in ServiceNow.
I am looking for a way to do this as seamlessly as possible. I have followed this guide: Implementing HTML in Comments - ServiceNow Wiki, with both Work Notes and additional comments, however I am having some issues.
1. Things entered in the new fields are correctly transferring to the OOB comments and work_notes fields and displaying html formatting with the exception of images. which are not displayed at all.
2. When attaching a suggested KB it ends up in description instead of the correct field (comments or u_comments) as the expected comments field is no longer on the form. I have looked but cannot find the logic that controls where to insert the attached KB text.
Any suggestions on how to solve the above or to better accomplish our goals?
Thanks,
-Josh
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- 20,595 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2015 08:24 AM
The below was provided mostly by ServiceNow support:
Steps to Resolution:
1) Set the field in question (or create a custom field) to Type: HTML
2) In the dictionary for the field, create an attribute for HTML Sanitize and set the value to false.
3) Create a business rule that auto inserts code tags and sets the Style to display: block
4) [OPTIONAL] I created another onDisplay business rule that wiped out the field so the content of the field did not linger.
Additional details
2. add html_sanatize=false to the attributes of the new html field.
3. add on before business rule to field
function onBefore(current, previous) {
//If no opening [code] tag found, wrap it.
var note = current.work_notes + "";
if (note.indexof("[code]") == -1) {
var wrappedNote = "[code]" + note + "[/code]";
note = wrappedNote;
}
// Clunky workaround to inject style attribute into image tags.
var noteStyle = note.replace(/\<img style\=\"/g, "\<img style\=\"display\: block\; ");
if (note != noteStyle) {
current.work_notes = noteStyle;
}
}
4. you will find that HTML fields do not clear field contents after submit so you can create an onDisplay script to clear the filed:
current.field_name = '';
NOTE: At this time this will prevent the Additional Comments block form generating correctly in notifications
Edit: fixed .replace as per Leslie's suggestion.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2022 06:55 AM
Hello
I come across this article before, also implemented live feed instead of using HTML field type for additional comment, as i believed live feed is a better option.
Recently, we upgraded to San Diego, too bad live feed and NEXT experience cannot work together.
have to disable the polaris view, as we need the live feed and there are history in the live feed.
in that case we are not able to upgrade the new interface in future because of the live feed!
Is there any idea how your take care this issues?
Any advice will be much appreciated.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2022 08:02 PM
No idea, sorry.
One of the rare occasions I feel like garbage for buying into product hype.
I LOVED live feed. But SN didn't believe in it as I did.
And so it didn't really grow.
And now it appears unsupported.
I'd be calling SN and asking them what they propose.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2015 07:38 AM
I am having the same issue. Any chance you have a workaround?
All of us are very frustrated by the struggles we are having with the lack of *Basic* attachment functionality.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2015 07:45 AM
Leslie Know unfortunately this is still unresolved.
I have been working with support on this issue (Images not displaying in Activity Log) and we discovered that there is an issue with the img HTML tag in the Activity log that appeared after Eureka.
This can be fixed by using a business rule to run a find replace on the appropriate field (work_notes or comments) as a before rule.
.replace("\<img style\=\"", "\<img style\=\"display\: block\; ");
This will make images appear in work notes but will break the built in code that generates the additional comments block for notifications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2015 07:50 AM
Nice! any way you can share the whole business rule with me? I've been wrestling with this for a while now. I would be very grateful. Thanks very much.