Solved

Conditional subject lines using template language–is it possible?

  • 27 October 2022
  • 1 reply
  • 202 views

Userlevel 4
Badge +7

Hi all,

Within a metric-based flow, I’d like to add a conditional subject line to an email.

However, I’m running into two problems...

First, I can’t write a subject line that exceeds 255 characters. Even though the subject would be resolved to way fewer characters, the character counter is including the template tags as characters.

Second, is this even possible? Can I use conditional template tags like {% if event.field %} in a subject line?

Here is my conditional.

{% if event.flag1 and event.flag2 %}✅ You're good!{% elif event.flag1 and not event.flag2 %}❌ You're maybe not so good!{% elif not event.flag1 and event.flag2 %}❌ You're definitely not good.{% elif not event.flag1 and not event.flag2 %}❌ You're not good at all. Definitely.{% endif %}

Thank you!

Kevin.

icon

Best answer by stephen.trumble 27 October 2022, 18:54

View original

1 reply

Userlevel 7
Badge +60

Hey @KeviSunshine 

Thanks for asking another great question! 

You can typically use any template tag or variable in the subject line that you would otherwise use in the body of the email. However, even though your tags would resolve to less than 255 characters, your code still has to fit within the 255 character limit and all on the same line. 

Hope this helps!

Reply