- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2024 06:51 AM
Hello folks,
I am trying to set the Work Notes field in red color using a Business Rule or any other method in ServiceNow. I've attempted a few solutions involving HTML tags and styles, but the text is not rendering as expected.
Could anyone provide guidance on the following?
- Business Rule Approach: How can I apply red color styling directly in the Work Notes field using a Business Rule? Any examples of how to inject the HTML properly would be very helpful.
- UI or Notification Approach: Are there any ways to modify the UI or Activity Stream so that the Work Notes appear in red color based on certain conditions?
I've already tried the following:
- Using <span style="color: red;">Text</span> inside the Business Rule but it doesn't seem to work as expected.
- Investigating the sys_ui_style table, but the field still does not reflect the red color.
Any assistance or examples would be greatly appreciated!
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2024 06:57 AM
this will work-> to allow html tags you need to add [code] tag
(function executeRule(current, previous /*null when async*/) {
var redText = '[code]<span style="color:red;">This is a red color text</span>[/code]';
current.work_notes = current.work_notes + '\n' + redText;
})(current, previous);
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
‎12-08-2024 03:47 AM
No worries.
Each day brings new lessons.
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
‎12-06-2024 06:57 AM
this will work-> to allow html tags you need to add [code] tag
(function executeRule(current, previous /*null when async*/) {
var redText = '[code]<span style="color:red;">This is a red color text</span>[/code]';
current.work_notes = current.work_notes + '\n' + redText;
})(current, previous);
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
‎12-06-2024 10:31 AM
Hi Ankur,
Thank you for taking the time to provide such a detailed response—I truly appreciate it. The approach you suggested using the [code] tag is insightful and a great suggestion. Unfortunately, it didn’t work as expected in my case. The Work Notes field still does not render the HTML in red color in my environment, possibly due to specific instance configurations or restrictions on how journal fields handle HTML tags.
If you have any additional suggestions or insights, I’d be happy to explore them further. Thanks again for your support and efforts in helping me!
Best regards,
Dany Rohinth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2024 02:52 AM - edited ‎12-08-2024 02:52 AM
Hi @Ankur Bawiskar ,
I hope this message finds you well.
I wanted to sincerely apologize for my earlier reply regarding the HTML rendering issue in the Work Notes field. Upon revisiting the setup on my end, I realized that the issue was due to an oversight in my implementation. The code you provided works perfectly, and I deeply regret any confusion my initial response may have caused.
Thank you for your patience and the detailed guidance you shared—it was indeed spot-on. I truly appreciate your expertise and the time you took to assist me.
Once again, I’m sorry for the misunderstanding, and I’m grateful for your continued support.
Best regards,
Dany Rohinth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2024 03:47 AM
No worries.
Each day brings new lessons.
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