Conditionally reveal sections on PDF template.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • espo_forum
    Junior Member
    • May 2018
    • 6

    Conditionally reveal sections on PDF template.

    Hi

    Similar to how we can show / hide panels in the crm based on another field's entries, can we do the same on templates?

    For example if i have multi-enum field which has entries '1', '2', '3' i may only want certain sections / 'panels' of my PDF template to show if 1, 2 or 3 have been selected?

    Thanks,
  • espo_forum
    Junior Member
    • May 2018
    • 6

    #2
    I can answer my own question here.

    You need to enclose any html you wish to conditionally show with tags like so:


    <!-- {{#ifEqual field1 'a'}} --> <div><p> stuff here</p> </div> <!-- {{/ifEqual}} -->


    You can also use ifNotEqual and else like so https://github.com/espocrm/espocrm/issues/645

    Comment

    • llsatellite
      Junior Member
      • May 2020
      • 12

      #3
      im using it like this but for some reason don't work i check the table and the info "Gas" is there if i add {{else}} it shows but i need it to shoe when condition is the same as {{Gas}}

      {{#ifEqual unit1Type "Gas"}}

      Comment

      • esforim
        Active Community Member
        • Jan 2020
        • 2204

        #4
        Haven't test but I make a few comments:

        1) I think it need to be 'Gas' and not "Gas"
        2) Did you copy the whole code? and it should be copy/paste in <> code view and not just normal.
        3) I think your code should be something like this maybe?

        <!-- {{#ifEqual unit1Type 'Gas'}} --> <div><p> stuff here</p> </div> <!-- {{/ifEqual}} -->

        Comment

        Working...