How to change font family in Mail Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2020 01:55 AM
Hi Community,
I'm using the reply, reply all and forward functions in record activity by adding the glide.ui16.emailStreamResponseActions to system properties. I noticed the time stamp "On 19/02/2020 11:15:48 GMT, 'XYZ' wrote:" is defaulting to font family other than in our client template and when you start a new reply above this is it also defaulting to Times New Roman.
I've played around adding a new template.print line to style this to Segoe UI without much luck and have tried some suggestions in other posts without any luck. Does anybody know what and where I need to add this in the below?
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// This mail script is intended to be used by the response client templates and will only work as expected
// if called from a template with a content type of HTML. current represents the original sys_email record.
var uname = current.user;
if (current.type != 'received') {
var u = new GlideRecord('sys_user');
uname = current.sys_created_by;
if (u.get('user_name', uname))
uname = u.name.toString() + '<' + u.email.toString() + '>';
}
var cdate = new Date();
cdate.setTime(current.sys_created_on.getGlideObject().getNumericValue());
var usePlainTextResponseContent = gs.getProperty('glide.email_client.use_plain_text_response', 'false');
if ((usePlainTextResponseContent == 'true' && !current.body_text.isNil()) || current.body.isNil()) {
template.print("<strong>On " + cdate.toLocaleString() + ", '" + uname + "' wrote:\n\n<strong>");
// Process plain text to dislay in HTML email client
template.print(sn_notification.EmailResponse.getOriginalEmailTextContent(current.getUniqueValue()));
} else {
var gdt = new GlideDateTime(cdate);
var curr_date = gdt.getDisplayValue();
template.print("On " + curr_date + ", '" + uname + "' wrote:\n\n");
template.print("<blockquote>");
// Remove html, head, body and style tags
template.print(sn_notification.EmailResponse.getOriginalEmailHtml(current.getUniqueValue()));
template.print("</blockquote></div>");
}
})(current, template, email, email_action, event);
The second issue i have is that in the email client when I use one of these functions is it enlarging the the space (about 1.5) between new lines of text. Does anybody know how I can overcome this?
Thanks,
James
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2020 03:52 AM
Hi,
You can use this :
template.print('<p><font size="3" face="arial">');
This changed the font size to 12 and font family to Arial.
You can use html to change to font using <font> tag
https://www.w3schools.com/tags/tag_font.asp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2020 04:53 AM
Hi Priyanka,
Where in the script would i place this?
Thanks,
James

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2020 04:16 AM
Hi
Please got through this link :
Email script : HTML syntax for Bold letters
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
sanjay bagri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2020 04:54 AM
This is for making text bold. I'm looking at changing font typeface.