- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2022 06:27 AM
Hi there,
I want to edit the font and size of the additional comments that are send within a email System Notification, from the default font, color and size, to "Trebuchet MS", "White", "10px".
I have tried several solutions from this community (see here below), but sadly, none of them works.
Anyone more tips/suggestions?
Thanks!
- https://community.servicenow.com/community?id=community_question&sys_id=24ee27731bb67f80fff162c4bd4bcb5b
- https://community.servicenow.com/community?id=community_question&sys_id=187043e1db98dbc01dcaf3231f96195d
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2022 09:16 AM
Please use below:-
var journalEntry = new GlideRecord('sys_journal_field');
journalEntry.addQuery('element', 'comments'); //Provide name of the journal field, here the field name is 'comments'
journalEntry.addQuery('element_id', current.sys_id); //Provide sys_id of the record on which the journal field is present, i.e, sys_id of the change request
journalEntry.orderByDesc('sys_created_on');
journalEntry.setLimit(1)
journalEntry.query();
while(journalEntry.next()) {
template.print('<p><span style="color: #ff0000; font-family: trebuchet ms, geneva; font-size: 10pt;"><strong>');
template.print('Comment : ' + journalEntry.value);
template.print('</strong></span></p>');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2022 07:36 AM
Finally found the solution. I modified my script again and this works. Only the font color is still an issue. Adding "font-color: #ff0000" for example, does not work.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
template.print('<p><span style="font-family: trebuchet ms; font-size: 10pt;">');
template.print(gs.getMessage(current.comments.getJournalEntry(1)));
template.print('</span></p>');
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2022 07:39 AM
Yes i also had some doubts on $comments part
Please try below:-
template.print('<p><font-size: 10pt; face="trebuchet ms">');
template.print(gs.getMessage(current.comments.getJournalEntry(1)));
template.print('</font></p>');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2022 07:39 AM
Ohh you already made it cool
If you could mark my answer correct/helpful based on impact will appreciate.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2022 07:41 AM
This works, but only for the font size. The font type stays the same.
I have still an issue in my script to apply another color to the text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2022 07:55 AM
I solved everything finally. This is the script;
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
template.print('<p><span style="color: #ff0000; font-family: trebuchet ms, geneva; font-size: 10pt;"><strong>');
template.print(gs.getMessage(current.comments.getJournalEntry(1)));
template.print('</strong></span></p>');
})(current, template, email, email_action, event);
Hereby some details:
- Only the last Additional Comment on the Incident form is shown.
- The font is "Trebuchet MS". You can adjust this if needed.
- The font size is "10pt". This can also be adjusted.
- The font color is now red, in hex. This can also been adjusted if needed.
Please mark answer correct/helpful based on Impact.