Conditional display of bank account depending on currency

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 5k18a
    Member
    • Jul 2025
    • 31

    #1

    Conditional display of bank account depending on currency

    I want to show different bank accounts in invoice PDF depending on the invoice currency (amountCurrency). Example:
    • if currency = PLN → show PLN account
    • if currency = EUR → show EUR account

    I tried directly in the template:
    {{#if (eq amountCurrency "PLN")}}
    Konto [PLN]: xxxxxxxxxx
    {{else}}
    Konto [EUR]: xxxxxxxxxx
    {{/if}}


    Also tried with nested {{#if}} blocks and with a formula:
    if (amountCurrency == 'PLN') {
    cBankAccount = 'xxxxxxxxxx';
    } else {
    cBankAccount = 'xxxxxxxxxx';
    }


    But none of these worked - in PDF it either shows both accounts, or the field stays empty.What is the correct way to make conditions based on amountCurrency in PDF templates (or via formula)?
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1720

    #2
    Hi, wrong tagging. Read here about the if and ifEqual: https://docs.espocrm.com/user-guide/printing-to-pdf/
    it should be something like

    {{#IfEqual amountCurrency 'PLN'}}
    Konto [PLN]: xxxxxx
    {{else}}
    Konto [EUR]. xxxxxx
    {{/ifEqual}}

    Put this in the code view of the PDF-Editor, also comment it out with <!--{{CODE}}-->

    Comment

    • yuri
      EspoCRM product developer
      • Mar 2014
      • 9279

      #3


      eq => equals

      I recommend using the x-if attribute instead: https://docs.espocrm.com/user-guide/...attribute-x-if
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      Working...