HUBL If Statements in email templates


I’m having a problem when trying to display a string of text with a value from a custom property on a contact (in an email template). I want to only show this string of text if a value exists for that particular user, but haven’t found a way yet of making this happen.

Here’s an example:

Active Students this week: 45%
(string of text): (value)

If it were only one value, we could filter all contacts out of the email that don’t have the value. However, there are 10-15 different dynamic values (all with their own labels) that I want to show. All contacts have a different number of the custom fields populated in Hubspot. We are currently showing “Active Students this week: n/a” by using a default value in Hubspot

I tried doing this with HUBL if statements - which would work conceptually, but then I found in a few other posts that indicate if statements based on contact properties are not usable in email templates because the HUBL evaluates before the contact property fields are populated.

So, I need another way to do this and I’m out of ideas. Using multiple email templates with segment filters is not an option because there is an exponential number of variations. Any suggestions?


Hi Ryan, were you able to figure this out ? Anyone have a solution for this ? we would like to use the IF based on {{custom. }} tag passed in the email at run time and not in the template



HubL if statements aren't currently supported in email templates, only in CMS blog/landing/website pages: