- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 09:40 AM
I have a notification that when sent to a budget holder, contains information regarding the item being purchased. The item has a cost and a recurring cost has also been added, however I see that there isn't field option for total cost that would include both of these together.
Has anyone made a mail script or know a way to achieve adding a 'total cost' value to the notification?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 01:03 PM
@Wasdom_Kung I am not 100% sure on the field names but below is an example.
Mail script example:
// Mail Script
(function() {
var cost = current.cost; // Replace with the actual field name for the cost
var recurringCost = current.recurring_cost; // Replace with the actual field name for the recurring cost
var totalCost = (parseFloat(cost) + parseFloat(recurringCost)).toFixed(2);
// Output the total cost
template.print("Total Cost: $" + totalCost);
})();
In the notification, within the message body, include the mail script tag:
${mail_script:total_cost_script}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 01:03 PM
@Wasdom_Kung I am not 100% sure on the field names but below is an example.
Mail script example:
// Mail Script
(function() {
var cost = current.cost; // Replace with the actual field name for the cost
var recurringCost = current.recurring_cost; // Replace with the actual field name for the recurring cost
var totalCost = (parseFloat(cost) + parseFloat(recurringCost)).toFixed(2);
// Output the total cost
template.print("Total Cost: $" + totalCost);
})();
In the notification, within the message body, include the mail script tag:
${mail_script:total_cost_script}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 02:04 AM
This worked, I was using the OOTB values so it would be recurring_price and price values, thanks!