
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 05:16 PM - edited 02-18-2024 02:45 PM
I have a mail script that is working as I'd like it to, other than the font and font size.
I've tried a number of things already, none of which have worked.
- Didn't work:
Solved: How do I change the font family and font size that... - ServiceNow Community - How to change the default font-family and font-size for email notifications - Support and Troublesho...
This one involved creating a mail template and I tried it, also didn't make a difference. - How to Change Font Style of email scripts - ServiceNow Community
I've also tried adding the following:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
if (current.variables.question1 == 'yes') {
template.print('<p style="font-size:11px; font-family: Calibri, sans-serif;"><li> The font is not working as expected.<br>');
}
})(current, template, email, email_action, event);
Also not worked:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
template.print('<p style="font-size:11px; font-family: arial;">');
if (current.variables.question1 == 'yes') {
template.print('<li> The font is not working as expected.<br>');
}
template.print('</p>');
})(current, template, email, email_action, event);
Assistance would be very much appreciated.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2024 08:20 PM
Hi,
Thanks for providing more info! That helps!
With what you've said, the part I provided would be added to your mail script, like example:
var body = '<span style="font-family: arial, helvetica, sans-serif; font-size: 11pt;">Testing 1 2 3!</span>';
template.print(body);
So that span style I've provided is for arial font size 11 with same example text.
If you were to create a test mail script with only what I've provided above and then add that to your notification instead of your current mail script, does everything all match font type and size?
If so, you can then continue to use that for your mail script and adjust your text, etc.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 06:58 PM - edited 02-15-2024 06:59 PM
Hi,
If you don't mind, can you give a bit more insight into what you're expecting and what you're seeing? I'm assuming you mean you're specifying the font type and size, like your question headline says, but what are you seeing? A completely different font altogether?
Have you tried something like:
<span style="font-family: arial, helvetica, sans-serif; font-size: 11pt;">Testing 1 2 3!</span>
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 07:37 PM
Thanks for the reply.
Yes so in the notification I have the font I want to use selected and working, then part way through I'm adding the mail script and the text that is added because of the script is coming in as a completely different font and font size.
EG:
All the first paragraph or 2 of text is added directly to the notification body and set as Arial size 11pt.
Then the mail script is added like this: ${mail_script:example} and that actually is also set to be the same (Arial 11pt) but when it is rendered it is coming out as new times roman 13.5pt
Then the following text added directly to the notification body is all Arial 11pt again.
As for the bit you've suggested how/where would that be added?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2024 08:20 PM
Hi,
Thanks for providing more info! That helps!
With what you've said, the part I provided would be added to your mail script, like example:
var body = '<span style="font-family: arial, helvetica, sans-serif; font-size: 11pt;">Testing 1 2 3!</span>';
template.print(body);
So that span style I've provided is for arial font size 11 with same example text.
If you were to create a test mail script with only what I've provided above and then add that to your notification instead of your current mail script, does everything all match font type and size?
If so, you can then continue to use that for your mail script and adjust your text, etc.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 06:46 PM
@Allen Andreas thank you, that worked with a small change so I could use it for each of my variables.
var mailfont = '<span style="font-family: arial, helvetica, sans-serif; font-size: 11pt;">';
if (current.variables.question1 == 'yes') {
template.print('mailfont <li> Question 1 answer text goes here<br>');
}
if (current.variables.question2 == 'yes') {
template.print('mailfont <li> Question 2 answer text goes here<br>');
}
if (current.variables.question3 == 'yes') {
template.print('mailfont <li> Question 3 answer text goes here<br>');
}