Mail script font wrong in notification

Bidduam
Tera Guru

I have a mail script that is working as I'd like it to, other than the font and font size.

 

I've tried a number of things already, none of which have worked.

 

I've also tried adding the following:

 

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

if (current.variables.question1 == 'yes') {
        template.print('<p style="font-size:11px; font-family: Calibri, sans-serif;"><li> The font is not working as expected.<br>');
    }

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

 

 

Also not worked:

 

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

template.print('<p style="font-size:11px; font-family: arial;">');

    if (current.variables.question1 == 'yes') {
        template.print('<li> The font is not working as expected.<br>');
    }

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

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

 

 

Assistance would be very much appreciated.

1 ACCEPTED SOLUTION

Hi,

Thanks for providing more info! That helps!

With what you've said, the part I provided would be added to your mail script, like example:

var body = '<span style="font-family: arial, helvetica, sans-serif; font-size: 11pt;">Testing 1 2 3!</span>';
template.print(body);

So that span style I've provided is for arial font size 11 with same example text.

If you were to create a test mail script with only what I've provided above and then add that to your notification instead of your current mail script, does everything all match font type and size?

 

If so, you can then continue to use that for your mail script and adjust your text, etc.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

5 REPLIES 5

Allen Andreas
Administrator
Administrator

Hi,

If you don't mind, can you give a bit more insight into what you're expecting and what you're seeing? I'm assuming you mean you're specifying the font type and size, like your question headline says, but what are you seeing? A completely different font altogether?

 

Have you tried something like:

 

<span style="font-family: arial, helvetica, sans-serif; font-size: 11pt;">Testing 1 2 3!</span>

 


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

@Allen Andreas 

Thanks for the reply.

 

Yes so in the notification I have the font I want to use selected and working, then part way through I'm adding the mail script and the text that is added because of the script is coming in as a completely different font and font size.

 

EG:

All the first paragraph or 2 of text is added directly to the notification body and set as Arial size 11pt.

 

Then the mail script is added like this:  ${mail_script:example} and that actually is also set to be the same (Arial 11pt) but when it is rendered it is coming out as new times roman 13.5pt

 

Then the following text added directly to the notification body is all Arial 11pt again.

 

As for the bit you've suggested how/where would that be added? 

Hi,

Thanks for providing more info! That helps!

With what you've said, the part I provided would be added to your mail script, like example:

var body = '<span style="font-family: arial, helvetica, sans-serif; font-size: 11pt;">Testing 1 2 3!</span>';
template.print(body);

So that span style I've provided is for arial font size 11 with same example text.

If you were to create a test mail script with only what I've provided above and then add that to your notification instead of your current mail script, does everything all match font type and size?

 

If so, you can then continue to use that for your mail script and adjust your text, etc.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

@Allen Andreas thank you, that worked with a small change so I could use it for each of my variables.

var mailfont = '<span style="font-family: arial, helvetica, sans-serif; font-size: 11pt;">';

    if (current.variables.question1 == 'yes') {
        template.print('mailfont <li> Question 1 answer text goes here<br>');
    }

    if (current.variables.question2 == 'yes') {
        template.print('mailfont <li> Question 2 answer text goes here<br>');
    }

    if (current.variables.question3 == 'yes') {
        template.print('mailfont <li> Question 3 answer text goes here<br>');
    }