Announcement

Collapse
No announcement yet.

conditional formula in email-template does not work as intended

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • conditional formula in email-template does not work as intended

    I would like to display a salutation in Email, depending on values of the salutationName field in leads.
    I have three values in salutationName: null, 'Herr' and 'Frau'. Depending on the value I want to display the salutation term, which is generated in another field named "briefanrede", as:
    null = 'Guten Tag', Herr = 'Sehr geehrter Herr' und Frau = 'Sehr geehrte Frau'.
    My ifEqual condition is this

    Code:
    {{#ifEqual salutationName ''}}Guten Tag,{{else}}{Lead.cBriefanrede} {Lead.lastName}{{/ifEqual}}
    It works on null, displaying "Guten Tag", but in the other cases, the null value is still present, displaying "Guten TagSehr geehrter Herr"

  • #2
    I could not reproduce the issue you described. But you need to use {{#unless salutationName}} instead, as ifEqual requires value types be the same.

    Comment


    • #3
      What I see now is very strange.

      The Email comes in, when sent automatically after creating lead, like first screenshot, if sent manually with the same template sent manually from the created lead:
      Last edited by shalmaxb; 09-07-2024, 10:06 AM.

      Comment


      • #4
        Click image for larger version

Name:	image.png
Views:	63
Size:	41.3 KB
ID:	110053

        This is not correct. Placeholders cannot be used in Handlebars helpers.

        Comment


        • #5
          I do not get, how I would have to tag it, if I want "Guten Tag" if salutaionName is null and the other form, when salutationName has a value.
          And why does it work, when Email is manually sent?

          I changed the condition, but always displaying the tag in the automatically sent mail, manually sent not.

          Code:
          {{#unless cBriefanrede}}Guten Tag{{else}}{Lead.cBriefanrede} {Lead.lastName}{{/unless}},
          Last edited by shalmaxb; 09-07-2024, 10:36 AM.

          Comment


          • #6
            You could be because automatic emails do not have a parent. https://docs.espocrm.com/user-guide/...lebars-support

            Comment


            • shalmaxb
              shalmaxb commented
              Editing a comment
              Thank you, I understand.
          Working...
          X