if condition in eMail template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MicKress
    Senior Member
    • Aug 2017
    • 105

    if condition in eMail template

    Hi there, is there a possibility to use an if Condition in a body Text of an eMail template? E.g. if field1 = "a" then text = "b"
  • VinhPN
    Junior Member
    • Jan 2019
    • 26

    #2
    In code editor:

    Code:
    <!-- {{#ifEqual field1 'a'}} -->
    b
    <!-- {{/ifEqual}} -->

    Comment

    • MicKress
      Senior Member
      • Aug 2017
      • 105

      #3
      Great! Thank you!

      Comment

      • Darkcromb
        Member
        • Aug 2019
        • 40

        #4
        It doesn't work for me.
        I have in my code editor :
        <p>{Person.name}</p><p>{Call.contact.name}</p><p>{Call.contact.estusager}<br></p><p>Concerne {Call.name}&nbsp;<span style="color: rgb(51, 51, 51);">(
        <!-- {{#ifEqual Call.contact.estusager 1}} -->
        Usager du social
        <!-- {{/ifEqual}} -->
        )</span></p><p>Type : {Call.type} Niveau d'urgence :&nbsp;{Call.urgence}</p><p>Objet : {Call.name}<br></p><p>Description :&nbsp;{Call.description}&nbsp;</p>

        (Call.contact.estusager is a tinyInt(1))

        When Call.contact.estusager=0, "Usager du social" is written anyway.
        I tried <!-- {{#ifEqual Call.contact.estusager "1"}} --> <!-- {{#ifEqual Call.contact.estusager '1'}} --> <!-- {{#ifEqual Call.contact.estusager true}} --> but it doesn't work (it's working in a PDF template)

        What am I doing wrong ?

        Comment

        • vps
          Junior Member
          • Dec 2019
          • 9

          #5

          We have the same problem. Handleable conditions do not work in normal email templates. Is there a workaround here? Click image for larger version

Name:	handlebars.PNG
Views:	716
Size:	79.5 KB
ID:	54270 Example:
          HTML Code:
              <!-- {{#if Lead.lastName}} --> <p> Dear Mr. {Lead.lastName}},</p> <!-- {{else}} --> <p>Dear Madam or Sir,</p> <!-- {{/if}} -->
          Attached Files

          Comment


          • esforim
            esforim commented
            Editing a comment
            Any luck? I probably want to add that if statement in future too.
        Working...