Client property in IF statement - Email template

Occasional Contributor

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?

3 Replies 3
Not applicable

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

Smart Content User Guide

Quick answers to your questions from the HubSpot Support team.

Reply
0 Upvotes
Occasional Contributor

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.

Regular Contributor

Yes, this is currently not implemented.

We added the query to have HUBL if's for emails, too.

If you agree, please support this idea which queries for if statements in HUBL for emails:
https://community.hubspot.com/t5/HubSpot-Ideas/if-statements-in-email-templates/idi-p/282907

Thank you very much!

Reply
0 Upvotes