One of the advantages of using Advanced PDF/HTML Template compared to Basic PDF Layouts is that users can apply If Conditions in the printed template since it uses freemarker. The format of an If Condition in freemarker is:
<#if record.[field] == [value]>Display text<#else>Display other text</#if>
In the snippet above, [field] is replaced by the Field ID of a Standard or Custom Field that is being evaluated, and [value] is replaced by the value to be matched with the value of the specified [field]. In this condition, if the value of [field] matches the assigned value, it will print "Display text". Otherwise, it will print "Display other text".
Here is a sample scenario:
There is a requirement to print "Approved!" if the Invoice has the Approval Status of Approved, and "Pending Approval" if the Approval Status is not yet set to Approved. With this, users can add the following to the Advanced Template's source code:
<#if record.approvalstatus == "Approved">Approved!<#else>Pending Approval</#if>
For additional reference about freemarker and this topic, check out the following link:
Do you have any samples or other tips when implementing If conditions in Advanced PDF/HTML Templates? Share it with us in the comments below!
https://freemarker.apache.org/docs/ref_directive_if.html