Announcement

Collapse
No announcement yet.

Email Template #if statements

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

  • Email Template #if statements

    I'm just looking for clarification on the status of #if statements in email templates. I'd like to do something like:

    Code:
    Dear {{#if Person.salutationName}}{Person.salutationName}{{else}}{Person.firstName}{{/if}} {Person.lastName},
    I thought this would work since https://docs.espocrm.com/user-guide/...mail-templates says it has Handlebars support since 5.9.0.

    I know from some posts say it will only work right on PDF templates and it does, which is great!

    I appreciate any help on the status of #if statements in email templates in 6.1.5.

    Thanks,
    Andrew

  • #2
    Hello,
    just see doc "Email templates also support handlebars. It's the same template system used for PDF templates with double-brace placeholders, like {{name}}"

    so look here : https://docs.espocrm.com/user-guide/printing-to-pdf/#if

    Comment


    • #3
      So helpful!

      So let's say that I am generating the E-mail using a template from a workflow, and I have some variables there, can I pass these variables using placeholders too? Or will they only work with entity attributes?

      Thanks!

      Comment


      • #4
        abisbe

        Yes you can pass variables from workflow to the email template using a placeholder {$$variableName}, you need to use save formula to save the variable before sending the email.

        Good luck
        Rabii

        Comment

        Working...
        X