Issue with appending fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi,
The Work Note Type should be appended to the Case Work Note (HTML filed) and made visible in the Activity section. Additionally, the Case Work Note text should be bold and set to 14pt font size.
Note: Case worknote which is mapped to the worknotes in activity
I have tried with business rule like below:
if (!current.u_case_worknotes || current.u_case_worknotes.nil()) {
return;
}
var notes = current.u_case_worknotes + '';
var type = current.u_work_note_type || 'Current Status';
// Clean HTML if pasted
notes = notes.replace(/<\/?[^>]+(>|$)/g, '');
// Prevent duplication
if (notes.startsWith(type)) {
current.work_notes = notes;
} else {
current.work_notes = type + '\n' + notes;
}
current.u_case_worknotes = '';
Out put:
So i want the Worknote type "Current status" should be bold with sixe 14pt also with some colour like below:
Can anyone please help on this, it will be useful.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi there @mania
Work Notes support limited inline HTML. In your script, HTML is getting stripped by the regex cleanup, which is why formatting isnt appearing.
if (current.u_case_worknotes.nil()) {
return;
}
var notes = current.u_case_worknotes + '';
var type = current.u_work_note_type || 'Current Status';
notes = GlideStringUtil.escapeHTML(notes);
var formattedType =
'<div>' +
'<span style="font-weight:bold; font-size:14pt; color:#0056b3;">' +
type +
'</span>' +
'</div><br/>';
if (!notes.startsWith(type)) {
current.work_notes = formattedType + notes;
} else {
current.work_notes = notes;
}
current.u_case_worknotes = '';
Kind Regards,
Azar
Serivenow Rising Star ⭐
Developer @ KPMG.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Thanks for responding,
I applied the code which your provided but i am getting like the below
Thanks!
