Font & size Additional Comments in email System Notifications

AdamUMC
Giga Guru

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

1 ACCEPTED SOLUTION

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>');

}

 

Please mark answer correct/helpful based on Impact.

View solution in original post

29 REPLIES 29

Saurav11
Kilo Patron
Kilo Patron

Though I do not see any issue with the links solution, maybe you can try the below code

template.print('<font size="10" face="trebuchet ms">');

 

Please mark answer correct/helpful based on Impact.

Thanks, but how can this work if nowhere is related to the "Additional Comments" field?

No i was just giving the font syntax please try below:-


template.print('<p><font size="10" face="trebuchet ms">');

template.print(gs.getMessage('${comments}'));

template.print('</font></p>');

 

Please mark answer correct/helpful based on Impact.

 

Thanks!

I have tried this in an email script, please see code below. But the Additional Comment stays the same in means of font and size. No changes; 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

          // Add your code here
template.print('<p><font size="10" face="trebuchet ms">');

template.print(gs.getMessage('${comments}'));

template.print('</font></p>');

})(current, template, email, email_action, event);


Referring to '${comments}' doesn't work I do think, because nothing is shown when I use this.
I have tried as shown in the script below, and this works, but the font size is bigger than what I have configured in the script ("10"). When I scale down to "3", it looks better. 

In my email System Notification, most text is 10pt. How can I manage to give this piece of Additional Comment exact the same size?

I modified the script below
- From "<font size ="10" face="trebuchet ms">"
- To "<font size ="10pt" face="trebuchet ms">"
But that 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><font size="10" face="trebuchet ms">');

template.print(gs.getMessage(current.comments.getJournalEntry(1)));

template.print('</font></p>');

})(current, template, email, email_action, event);