how to combine if statements in PDF template if(and/or)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamie
    Senior Member
    • Aug 2025
    • 316

    #1

    how to combine if statements in PDF template if(and/or)

    i am trying to do a simple logical and statment inside the PDF templates and nothing is working

    i have read through this documentation, it isn't helpful , i have asked AI to figure it out, it could not.


    yuri rabii shalmaxb how do i do this inside a pdf template?

    {{#if (and (notEqual cInvoiceType 'Delivery Note') (notEqual cInvoiceType 'Despatch Note') ) }}
    <p class="text-xs mt-10"> wibble</p>
    {{/if}}

    Whenever I try this, I get

    [2026-05-27 06:51:12] ERROR: Formula function: ext\pdf\generate, Error while generating. Message: Error in 'and (notEqual cInvoiceType \'Delivery Note\') (notEqual cInvoiceType \'Despatch Note\'': expect ')' but the token ended!!.

    ​the brakets complet. From what I got from the limited documentation, this is the way to do it. Is there another way? Am I doing it wrong? What did i miss in the documentation?
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 9843

    #2
    I copy pasted it and it worked for me, no error. Though it was on the dev version where we have the lib upgraded. The code looks correct.

    I suggest trying on a clean instance to rule out the code base being out of sync.

    Comment


    • yuri
      yuri commented
      Editing a comment
      Also to check whether the code works when it's in the very root of the document (not included in other blocks).

    • jamie
      jamie commented
      Editing a comment
      template works just fine without that line, but when i add it i get all kinds of errors.

      so that is the official way to do an AND statement inside a pdf template?

    • jamie
      jamie commented
      Editing a comment
      what lib is upgraded?
Working...