how do I write a formula in an email template, ie:...
# general
b
how do I write a formula in an email template, ie: ${customer.consolDaysOverdue - 60} tried multiple different formats but no luck so far
j
Try something like this
<#assign days_overdue_minus_sixty = customer.consolDaysOverdue - 60/>
Then you should be able to use that variable in your template
${days_overdue_minus_sixty}
b
Hi Jen, thank you for reply, I tried that and received:
The template cannot be saved due to the following errors:
The following has evaluated to null or missing:. ==> days_overdue_minus_sixty [in template "content" at line 3, column 98]. . ----. Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present#elsewhen-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??. ----. . ----. FTL stack trace ("~" means nesting-related):. - Failed at: ${days_overdue_minus_sixty} [in template "content" at line 3, column 96]. ----
j
Does customer.consolDaysOverdue exist?
Can you maybe show a snippet of your template?
b
it does exist,
Customer is ${customer.consolDaysOverdue} days past due and will be put on credit hold if we do not receive payment by the time they are 60 days past due.   Sales Rep: ${customer.salesRep} Customer: ${customer.entityId} ${customer.companyName} Days Over Due: ${customer.consolDaysOverdue} this customer's over due balance: ${customer.overdueBalance} Over Due Balance consolidated ${customer.consolOverdueBalance}
j
Can you post the part with your #assign and using the variable?
b
I pasted at the top of the template, just as you had typed it
I'm just going to leave it the way it is, they can do the math, thank you for your help