Need help in formatting mail script font/style to be consistent with the Notification

Ljone
Giga Contributor

Hi Experts,

Need your help in formatting my mail script font/style to be consistent with the Notification we have.

We have a notification which per checking is using Arial font, size 12. This notification is calling a mail script. 

Now, when the notification is viewed they have different Font and Style. I have added below line of code to my mail script but not helping. template.print('<p><font size="3" color="#000000" face="arial">');

Please help!

 

Mail Script

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {
    var item = new GlideRecord('sc_req_item');
    item.addQuery("sys_id", current.request_item);
    item.query();
 
    if (item.next()) {
 
        template.print('<p><font size="3" color="#000000" face="arial">');
        template.print("Transfer To Location: " + item.variable_pool.transfer_to_location.getDisplayValue() + "<br />");
        template.print("Transfer To Business Unit: " + item.variable_pool.transfer_to_bu.getDisplayValue() + "<br />");
        template.print("Transfer To Cost Centre: " + item.variable_pool.transfer_to_cost_center.getDisplayValue() + "<br />");
 
    }
})(current, template, email, email_action, event);

 

Notification Preview: 

find_real_file.png

 

HTML source code of Notification

<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">Hi,</span></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">An Asset Transfer Request has been approved and the below task is required to be completed:&nbsp;</span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;"><strong>${number} - ${short_description}</strong></span></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">Opened by: ${opened_by} on ${opened_at}</span></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">Description: </span></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">${description}</span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">Request: ${request_item.request.number} - ${request_item.request.short_description}</span></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">Request item: ${request_item.number} - ${request_item.cat_item}</span></p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">Request opened: ${request_item.request.opened_at} &nbsp;</span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"><span style="font-family: arial, helvetica, sans-serif; color: #000000;">${mail_script:task_asset_transfer}</span></span></p>
<p>&nbsp;</p>
<p><span style="font-family: arial, helvetica, sans-serif; font-size: 12pt;">${mailto:mailto.close_task}</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div align="center">${mail_script:ah_item_view_sc_task}</div>
<p>&nbsp;</p>
<p>&nbsp;</p>

1 ACCEPTED SOLUTION

Hello @Ljone ,

try with this script i think it applied but we did not apply the correct CSS try below code

template.print('<p style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;>")
template.print("Transfer To Location: " + item.variable_pool.transfer_to_location.getDisplayValue());
template.print( "<br /></p>");
template.print('<style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">') 
template.print("Transfer To Business Unit: " + item.variable_pool.transfer_to_bu.getDisplayValue());
template.print( "<br /></p>");
template.print('<p style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000;">') 
template.print( "Transfer To Cost Centre: "+ item.variable_pool.transfer_to_cost_center.getDisplayValue());
template.print( "<br /></p>");

View solution in original post

7 REPLIES 7

Mohith Devatte
Tera Sage
Tera Sage

Hello 

Can you please try replacing your if loop lines like below

template.print('<p><font size="3" color="#000000" face="arial">');
        template.print("<p style='font-size=3 ;color=#000000; face=arial'>Transfer To Location: " + item.variable_pool.transfer_to_location.getDisplayValue() + "<br /></p>");
        template.print("<p style='font-size=3 ;color=#000000; face=arial'>Transfer To Business Unit: " + item.variable_pool.transfer_to_bu.getDisplayValue() + "<br /></p>");
        template.print( "<p style='font-size=3 ;color=#000000; face=arial'>Transfer To Cost Centre: "+ item.variable_pool.transfer_to_cost_center.getDisplayValue()+"</br ></p>");

Please mark my answer correct if it works

Hi Mohith,

The font/style/spacing is still different. Please see belowfind_real_file.png

 

 

hello @Ljone ,

see below script and replace once and try

template.print('<p style="font-size:3px ;color:#000000; face:arial">')
template.print("Transfer To Location: " + item.variable_pool.transfer_to_location.getDisplayValue());
template.print( "<br /></p>");
template.print('<p style="font-size:3px ;color:#000000; face:arial">') 
template.print("Transfer To Business Unit: " + item.variable_pool.transfer_to_bu.getDisplayValue());
template.print( "<br /></p>");
template.print('<p style="font-size:3px ;color:#000000; face:arial">') 
template.print( "Transfer To Cost Centre: "+ item.variable_pool.transfer_to_cost_center.getDisplayValue());
template.print( "<br /></p>");

Mark it correct if it solves the issue

Hi Mohith,

It is still not working 😞 Below is the notification setup I have.

 

 

find_real_file.png

 

find_real_file.png