If statement contact property


Hello Everyone,

I am attempting to create an email that shows content based on contact properties, but for some reason the if statements don’t seem to work. If I put in the HUBL for the contact property it will show up, but the if statement will not.

Here is the code from the email template:

{% if contact.do_you_have_small_children_or_pets_ == ‘Yes’ %}

Text for small children and pets.

{% endif %}

{% if contact.are_the_windows_in_a_hard_to_reach_spot_ == ‘Yes’ %}

Text for hard to reach windows.

{% endif %}

I know the contact properties are correct and are loading because I get the double ‘Yes’ in the email if I send it as if it is going to the user with the 2 Yes properties. I am thinking there is a problem with the if statement or I am not reading the contact property field properly. Sorry I usually work with PHP.

If anyone has any ideas I would greatly appreciate it.

How to send list of objects using single send APi


using hubl in an email is supported for the moment in HubSpot



@fcomstoc this is actually expected behavior. The HubL logic executes before the the contact property personalization tokens are filled in so the if statement will always evaluate to false.

The best way to accomplish this is to use Smart Content. You could create a list for people who “have small children or pets” then have a rich text module in your template. That module can be made smart based on the list you created.

NOTE that a module that has been made smart acts more like switch statement in PHP so you can have multiple versions of the same module beyond the simple “yes it is true or no it’s not” style logic.