On the updated FreeMarker, the mathematical equations using field IDs is no longer supported (e.g. ${fieldA} - ${fieldB}). To resolve this, users will have to assign the field IDs to a variable before performing the equation.
1. Navigate to Customization > Forms > Advanced PDF/HTML Templates
2. Customize a Standard form or Edit an existing Customized form
3. Click on Source Code. This will prompt the user with a warning.
Note: The following should be applied to the item list section of the code.
In this example, a Sales Order is used and the value to be computed is Quantity Backordered, which is the difference of Quantity and Quantity Fulfilled.
4.Add a new header:
<th> (Any label) </th>
(Example: Quantity Backordered)
5. Assign the Quantity and Quantity Fulfilled fields to a variable:
<#assign varA = item.quantity>
<#assign varB = item.quantityfulfilled>
Note: Ensure that the name of the variables is easy to remember and related to the value it is referencing.
6. Add a <td> to compute for the Quantity Backordered:
<td> ${varA-varB} </td>
7. Click Save
Then, print a sample Sales Order to verify that the formula generates the correct value.