HTML support for work note
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi All,
Is there any way that we can push HTML format in work note section from server side code ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
32m ago - last edited 31m ago
@jobin1 do you mean, save the text with html tags as shown below? then it is straight forward
var incident = new GlideRecord("incident");
//example
if(incident.get("558c70694737e2508aca35ca116d436e")){
incident.work_notes = "<p>This line will be preserved.\nAnd this is the next line.<p>";
incident.update()
}
Or do you want render html in worknotes like below?
var incident = new GlideRecord("incident");
if(incident.get("558c70694737e2508aca35ca116d436e")){
var myHtmlContent = "The **Work Note** has been updated with formatted text.<br/>";
myHtmlContent += "<ul><li><span style='color: blue;'>Important Detail 1</span></li>";
myHtmlContent += "<li><span style='font-weight: bold;'>Detail 2</span></li></ul>";
myHtmlContent += "Click <a href='https://yourinstance.service-now.com/nav_to.do?uri=incident.do?sys_id=" + incident.sys_id + "'>here</a> to view the record.";
// Set the work_notes field
incident.work_notes = "[code]"+myHtmlContent+"[/code]";
incident.update()
}
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks!
Krishnamohan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11m ago
yes that's possible.
wrap the HTML code inside [code][/code] tag and you are done
something like this in background script on incident to update as example
How do I display a clickable URL in my work notes? Please do not use the example that uses [code].
This KB explains
Render journal field entries as HTML
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4m ago
Yes, it is supported. Refer below thread for usage and system properties to configure
As per community guidelines, you can accept more than one answer as accepted solution. If my response helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan