Skip to main content
Solved

Conditional subject lines using template language–is it possible?

  • October 27, 2022
  • 1 reply
  • 383 views

KeviSunshine
Expert Problem Solver III
Forum|alt.badge.img+8

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.

Best answer by stephen.trumble

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!

View original
Did this topic or the replies in the thread help you find an answer to your question?

1 reply

stephen.trumble
Community Manager
Forum|alt.badge.img+60
  • Community Manager
  • 1518 replies
  • Answer
  • October 27, 2022

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!