Custom font in HTML fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2019 05:58 AM
Hi,
We have a requirement for a customer that wants to use their own custom font they have created themselves - which means its not a google font, or available from adobe typekit or anything else. A 100% custom font, we have locally.
At first i tried to add the font as an attachment to the theme, add a CSS Include and a Style sheet - but this only seems to work on Service Portal. Here i can choose the font, and it works fine.
But the actual requirement is that when they generate email notifications and stuff like that, they want to be able to choose their specific custom font in the HTML field.
The font i uploaded is named "xxx" and i have tried to update the sys_property "glide.ui.html.editor.v4.font.collection" to include the value as "xxx=xxx;
Now the "xxx" becomes 'available' in the dropdown of fonts - but the acutal font it chooses is the first available of the OOTB fonts - like it doenst find anything or has anything connected to the name.
Does anyone know anything about this or can point me in the right direction? i cant seem to find where OOTB fonts are stored and dig my way in from there...
Thanks in advance.
Kasper
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2019 05:35 AM
The thing about fonts in emails is that custom fonts aren't really supported. And if custom fonts are supported, it works basically the same way fonts would work on a web page.
What this means is that the fonts need to be supplied. For example if I change the fonts while creating an email and send to someone it doesn't guarantee the person receiving the email is going to see the same fonts unless their computer or email client has those same fonts or unless the fonts are supplied via a link.
Just like on a web page custom fonts for email will need to be embedded which means the fonts need to be hosted somewhere on the net. Here are examples of three ways that I'm familiar with on embedding fonts:
-
@import url('//fonts.googleapis.com/css?family=Roboto+Condensed&display=swap" rel="stylesheet") /*goes in the style sheet and must be at the top before any other rules*/
-
<link href="//fonts.googleapis.com/css?family=Roboto+Condensed&display=swap" rel="stylesheet"" rel="stylesheet" type="text/css"> <!-- normally within the head tags-->
-
@font-face { font-family: "font of all knowledge"; src: url('//fonts.googleapis.com/css?family=Roboto+Condensed&display=swap'); }
With that said give this a try:
- ServiceNow does have a place where you can put style sheets or your fonts
Navigate to Content Management ->Design -> Style sheets in left nav - Click New
Give it a name and for the type you can choose to have it just link to an external sheet or if you already have data you can enter as your font styles you can use local style sheet and copy paste your styles in the given textarea.
I chose to link and then import as I used a Google font in my example
- save
- Imported
- end result
3. After saving grab the sys_id that record and either the updated date or created on date
4. Put together a url in this format: //[instance_name].service-now.com/[sys id of record].cssdbx?v=[date and time of record]
ie: //myinstance.service-now.com/52f11b6fdb373f002be0a851ca9619ca.cssdbx?v=2019-09-18 04:05:31
5. Go to the notification record that you want to include the custom font
6. Click the "<>" icon to use the code editor
7. Place your url at the top in a link tag in between p tags
<p><link href="//myinstance.service-now.com/52f11b6fdb373f002be0a851ca9619ca.cssdbx?v=2019-09-18 04:05:31" rel="stylesheet"/></p>
<p style="font-family: [name of your font family];">Testing</p>
8. Once that is done every subsequent newline that is added should automatically add that style. "But always check just in case"
9. Now you can test. Here are my results looking at the preview in ServiceNow instance and receiving it at the client side
Looks good here
Example received at email client (GMail) But doesn't look so good here as recipient.
I hope this helps. It might work if they host their fonts external from ServiceNow.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2019 12:48 PM
Thank you Chris. I work with Kasper on the project that needs this custom font. I will see if I can get it to work following your steps.
What Kasper forgot to mention is that we will generate a pdf file of the letter using the custom font. So it should not matter that the recipient do not have the font insstalled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 09:09 AM
it looks like you are facing problem using custom font in email notification. using custom font in email notification, make sure that the font linked correctly in your html file including font family in css. for step-by-step instructions check out this article on how to add font in html.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 09:29 AM
it looks like you are facing problem using custom font in email notification. using custom font in email notification, make sure that the font linked correctly in your html file including font family in css. for step-by-step instruction check out this article on how to add font in html