How to use a check box as a condition in an IF statement in a Advanced PDF/HTML temple

I have a custom check box on a sales order and if this is checked I want another custom field to display on the sales order PDF. I have tried the below IF statement but it is throwing an error. How do I check if a checkbox is ticked in an IF statement?

 

<#if record.custbody_custom_address == “T”>${record.custbody_entity_id}</#if>

Beginner Asked on October 1, 2020 in Partners.
Add Comment
2 Answer(s)
Best answer

We use the following snippet to indicate a note on the PDF.


<#if record.custbody_specialitem == true><b>This is a special item.</b> Expect a phone call to coordinate further information</#if>

Rookie Answered on October 1, 2020.

Thanks! that’s worked 🙂

on October 1, 2020.
Add Comment
Just for future reference: To Solve errors while using condition on Checkbox in PDF template like 'For "#if" condition: Expected a boolean, but this has evaluated to a sequence+hash+string' etc.
<#if (record.custbody_specialitem?is_boolean && record.custbody_specialitem) || (record.custbody_specialitem?is_string && record.custbody_specialitem == 'T')
Rookie Answered on July 6, 2022.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor