- 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-25-2022 07:45 AM
Sadly this does not work. No output is made.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2022 07:53 AM
Can you share the code you used?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2022 08:07 AM
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', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); //Provide sys_id of the record on which the journal field is present, i.e, sys_id of the change request
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('Commented By : ' + journalEntry.sys_created_by);
template.print('Commented On : ' +journalEntry.sys_created_on + '<hr>');
template.print('</strong></span></p>');
}
Probably I need to put something at the "XXXXX" line, but what?
I have also tried this, its my original script, but I changed;
FROM: "template.print(gs.getMessage(current.comments.getJournalEntry(1)));"
TO: "template.print(gs.getMessage(current.comments.getJournalEntry(1))).match(/\n.*/gm).join("\n");"
I got it from here:
- How to remove time stamp and name from additional comments? - Developer Community - Question - Servi...
- Remove User info and timestamp from commets - Developer Community - Question - ServiceNow Community
(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: #ffffff; font-family: trebuchet ms, geneva; font-size: 10pt;"><strong>');
template.print(gs.getMessage(current.comments.getJournalEntry(1))).match(/\n.*/gm).join("\n");
template.print('</strong></span></p>');
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2022 08:14 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('Commented By : ' + journalEntry.sys_created_by);
template.print('Commented On : ' +journalEntry.sys_created_on + '<hr>');
template.print('</strong></span></p>');
}
Please mark answer correct/helpful based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2022 08:33 AM
Thanks. This results in the date and time being mentioned at the end of the sentence, not at the start.
I see I made a mistake yesterday while writing.
I want to delete the author of the comment, the date and time. 🙂 Sorry for the inconvenience.
Please mark answer correct/helpful based on Impact.