MailScript to print table/cells by using html

abhaysingh98
Tera Contributor

Hi guys,

 

I want to print 2 rows in my email notification, I am trying to use html code to achieve this and also want to print some value based on some condition below is the mailscript that I am using but its not working as expected.

 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
 
    var totalRecurringPrice = current.sysapproval.quantity * current.sysapproval.recurring_price.getReferenceValue();
    var formattedPrice = current.sysapproval.recurring_price.getReferenceCurrencyCode() + " " + parseFloat(totalRecurringPrice).toFixed(2);

    var getReccFre = current.sysapproval.getRefRecord();
    // var choiceValue =getReccFre.getValue('recurring_frequency');
    var finalValue = getReccFre.getDisplayValue('recurring_frequency');


    if (current.sysapproval.recurring_price && current.sysapproval.recurring_price.getReferenceValue() != 0){
template.print('<tr style="height: 15.3906px;">
<td style="width: 39.9742%; height: 15.3906px;">"<p>Recurring Price:</p> "</td>
<td style="width: 59.9613%; height: 15.3906px;">formattedPrice</td>
</tr>
<tr style="height: 15.3906px;">
<td style="width: 39.9742%; height: 15.3906px;">"<p>Recurring Price Frequency:</p> "</td>
<td style="width: 59.9613%; height: 15.3906px;">finalValue</td>
</tr>')
    }
})(current, template, email, email_action, event);