Template.Print font setting for comments_work_notes

Bridget6
Kilo Expert

I am attempting to create an email script that will set the font for comments and work notes from change requests in an email notification. The script below will add the comments but it will not set the font. Would really appreciate any assistance with getting the font set so it matches the rest of the notification.

 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {


template.print('<p><span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;">${comments_and_work_notes}</span></p>');

})(current, template, email, email_action, event);

12 REPLIES 12

Will it let you save with the error? Because that could be coming from somewhere higher up. 

The way the 'template.print()' works is it prints out a string, which usually has your style tags and markup in it, with a variable. So as long as you know "${comments_and_work_notes}" works then use that. BUT it will have to have the plus sign before and after it to tie it to the rest of the string. 

The Strings you are attaching to it will be the tags and markup, so opening with single quoute up to the plus sign, then again after the second plus sign. You could use double quotes in the middle of the string for styles so it does not break the string. So using this SHOULD work if the variable in the middle is correct. Try changing the style to 30pt so you know if its catching it. 

template.print('<p><span style="font-family: arial, helvetica, sans-serif; font-size: 30pt;">' + ${comments_and_work_notes} + '</span></p>');

 

 

Thanks for that info. I do know ${comments_and_work_notes} brings in the information on the notification if I put it there directly. I am unable to modify the font type or size for that field directly on the notification.

Thats very strange. I have done this in the past where I broke them up and it worked. 

template.print('<p><font size="4" color="#999999" face="helvetica"><strong>');
template.print('${comments_and_work_notes}');
template.print('</strong></font></p>');

That one makes the text bold but doesn't change the font. Perhaps it's the comments_and_work_notes field causing the issue. I'll try to call the work_notes field instead.