Client property in IF statement - Email template


#1

I have a list of questions with drop-down choices and based on the answers I want to generate email report.

Ideally, HubL should solve it with something like that:

{% if contact.custom_property == “Answer 1” %}
Some text for Answer 1
{% elif contact.custom_property == “Answer 2” %}
Some text for Answer 2
{% else %}
No answer
{% endif %}

…but it doesn’t work. I can call the property {{ contact.custom_property }} in the template, but can’t use it in statements or variables.

Is there any easy way of achieving a similar result?


#2

There’s a note below the explanation for how conditionals in the documentation.

Please note that conditional logic written in templates can only be based on information available at the template level, not information from the contacts database. To change the way that a page renders for a particular contact, use smart content.

I’m guessing from the fact that it’s contact.custom_property you’re looking to delimit on that’s from the contacts database. I’m also guessing the smart content stuff is what you’re looking for


#3

Thanks for the reply Tidyl.
Yes, I’m aware it doesn’t work this way, that’s why I’m trying to find any other solution.
Smart content is limited to a couple of options, custom contact properties are not one of them. Smart lists work only with Country, Device, Referral, Language, Contact List and Lifecycle Stage. There’s no option to choose a custom one so it does not solve the problem.