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

Ahh we always paste at the same time:-

You can mark my answer correct/helpful based on Impact.

Thanks.

Also to give you an idea for next time if you want to get the html code you can just set the font color size on the message html of notification itself and then open the source code

find_real_file.png

You will see all the syntax then you can sue it in message html

Try this:-

 


template.print('<p><span style="font-family: trebuchet ms; font-size: 10pt;">');

template.print(span style="color: #00ffff;");

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

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

AdamUMC
Giga Guru

Thanks Saurav.

It seems that I still have another issue to solve.

The Additional Comment is shown with the authors name, date and time on the same rule as the comment itself. How to split this and to have eachother at an new rule?

Then you need to glide to sys_journal_field field.

 

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

}

 

Please mark answer correct/helpful based on Impact.