How to change font family in Mail Script?

James Rostron1
Tera Expert

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?

find_real_file.png

Thanks,

James

10 REPLIES 10

Hi Please try This :

template.print('<p><font size="3" face="arial">');

Sure It Will work.

This email script is OOB Please check : 

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
sanjay bagri

Are you saying I should edit this and change "helvetica" or copy the 2nd line into the other mail script?

Suppose you want to change the font size and face of this Line : 

if ((usePlainTextResponseContent == 'true' && !current.body_text.isNil()) || current.body.isNil()) {

template.print('<p><font size="14" color="#808080" face="arial">');

 //face and size according to your requirements you can write. 

template.print("<strong>On " + cdate.toLocaleString() + ", '" + uname + "' wrote:\n\n<strong>");

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

// Process plain text to dislay in HTML email client

 

"helvetica" it is a face you can select as you want.

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
sanjay bagri

 

Hi Sanjay,

Thanks for the suggestion. I tried it but it didn't work sadly.

James