Font Style in Email Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 04:13 AM
Hello Friends,
I have prepared some email notification emails that display some data, and some are hyperlinks. But font style and font size I want to add so that those email scripts also will be having same font style like notification email content.
Please help on this, I have stored all information from email notification into variables that are displaying information like:
template.print(PrintVa);
template.print(acknowledge_URL);
template.print(ref_notes);
thanks,
Basant Soni
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 04:18 AM
Hi Basant,
you can give the css inside template.print
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2019 04:36 AM
You can achieve this by writing below script in email script :
For eg.:
template.print('<p style="font-size:12px; color:#000000; font-family:arial"><strong>');
template.print(PrintVa);
template.print('</strong></p>');
Regards,
Sanket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2019 05:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2019 06:08 AM
Without knowing what you're trying to make it look like or how you're going about it, it's hard to get specific, but in general I'd look at an existing notification/script that does what you're trying to do and use that for guidance. If the styling is done in a mail script (as it is with almost all of the content in an Incident notification) then you can duplicate the style attributes in your own script -- or if you're just modifying the existing script, make sure you put your text above the </element> that terminates the styling (I just had to fix a script where a consultant had put the additional text below the </font></p> and it was using the default style). For examples of several different style applications done in a mail script, you can look at almost any of the ones triggered off Incident. Incident assigned to me is a good example, because all of the styling is done within the mail scripts in the body.
If the styling you're trying to use is in the message body itself, the "<>" (Source code) button can tell you a lot. Examples are a little harder to come by for this, but I did find one called Change Survey that gives you something to start with:
Click the <> button and it shows you this pop-out:
I'll have to defer on what styling you can do with a template, but it seems like you could create CSS classes within that which might cause you a headache if you don't know they're there. I don't know if this applies in your case, but it's worth looking into. The same HTML editor is used for templates, so you have the same options as you would in a message body.
Good luck!