MailScript to print table/cells by using html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 11:35 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 11:48 PM
Can you try the below corrected script :-
(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 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);