How to change Email script font size to Verdana

Aparna Gurav
Tera Contributor

Hello Expertise,

Can anyone help me with the email script? for changing the font to Verdana.

 

Please find my below script.

 

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

// Add your code here

var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.document_id);
gr.query();
if(gr.next()){

var quantity = gr.quantity;
var requestedFor = gr.requested_for.name;
var openedBy = gr.opened_by.name;
var item = gr.cat_item.name;
var shortDescription = gr.short_description;

template.print('<p style="font-size:10pt; font-family:verdana">');
template.print('<p> Requested For: ' + requestedFor + '</p>');
template.print('<p> Requested By: ' + openedBy + '</p>');
template.print('<p> Quantity: ' + quantity + '</p>');
template.print('<p> Requested Item: ' + item + '</p>');
template.print('<p> Short Description: ' + shortDescription + '</p>');

email.addAddress("cc", gr.requested_for.email, gr.requested_for.name);
email.addAddress("cc", gr.opened_by.email, gr.opened_by.name);
template.print('</strong></p>');
}

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

1 ACCEPTED SOLUTION

Hi @Aparna Gurav 

Can you try below 

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

// Add your code here

var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.document_id);
gr.query();
if(gr.next()){

var quantity = gr.quantity;
var requestedFor = gr.requested_for.name;
var openedBy = gr.opened_by.name;
var item = gr.cat_item.name;
var shortDescription = gr.short_description;

template.print('<p style="font-size:10pt; font-family:verdana"><strong>');
template.print('<p> Requested For: ' + requestedFor + '</p>');
template.print('<p> Requested By: ' + openedBy + '</p>');
template.print('<p> Quantity: ' + quantity + '</p>');
template.print('<p> Requested Item: ' + item + '</p>');
template.print('<p> Short Description: ' + shortDescription + '</p>');

email.addAddress("cc", gr.requested_for.email, gr.requested_for.name);
email.addAddress("cc", gr.opened_by.email, gr.opened_by.name);
template.print('</strong></p>');
}

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

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

View solution in original post

4 REPLIES 4

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Aparna Gurav 

You can change the font type in email scripts as below:

 

for eg.:

template.print('<p style="font-size:12px; color:#000000; font-family:arial"><strong>');
template.print(PrintVa);
template.print('</strong></p>');

  


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

If that is not working then give a try for below :-

 

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

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

 

KB article for reference :-

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0783405 

 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

@Gunjan Kiratkar - Thanks for the reply.

 

I Update your suggestion in my mail script but it's not working, can you tell me the exact placement of above suggestion.

 

AparnaGurav_0-1669284067181.png

For your reference please check my email script. and Want Verdana as font family and size-10

 

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

// Add your code here

var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.document_id);
gr.query();
if(gr.next()){

var quantity = gr.quantity;
var requestedFor = gr.requested_for.name;
var openedBy = gr.opened_by.name;
var item = gr.cat_item.name;
var shortDescription = gr.short_description;

template.print('<p style="font-size:10pt; font-family:verdana">');
template.print('<p> Requested For: ' + requestedFor + '</p>');
template.print('<p> Requested By: ' + openedBy + '</p>');
template.print('<p> Quantity: ' + quantity + '</p>');
template.print('<p> Requested Item: ' + item + '</p>');
template.print('<p> Short Description: ' + shortDescription + '</p>');

email.addAddress("cc", gr.requested_for.email, gr.requested_for.name);
email.addAddress("cc", gr.opened_by.email, gr.opened_by.name);
template.print('</strong></p>');
}

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

Hi @Aparna Gurav 

Can you try below 

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

// Add your code here

var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.document_id);
gr.query();
if(gr.next()){

var quantity = gr.quantity;
var requestedFor = gr.requested_for.name;
var openedBy = gr.opened_by.name;
var item = gr.cat_item.name;
var shortDescription = gr.short_description;

template.print('<p style="font-size:10pt; font-family:verdana"><strong>');
template.print('<p> Requested For: ' + requestedFor + '</p>');
template.print('<p> Requested By: ' + openedBy + '</p>');
template.print('<p> Quantity: ' + quantity + '</p>');
template.print('<p> Requested Item: ' + item + '</p>');
template.print('<p> Short Description: ' + shortDescription + '</p>');

email.addAddress("cc", gr.requested_for.email, gr.requested_for.name);
email.addAddress("cc", gr.opened_by.email, gr.opened_by.name);
template.print('</strong></p>');
}

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

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy