- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 01:38 AM
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);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 02:14 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 01:51 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 01:54 AM - edited 11-24-2022 01:56 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 02:03 AM
@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.
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 02:14 AM
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);