APIs & Integrations

ryanwalker
Member

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?

3 Replies 3
BiG
Contributor

HUBL If Statements in email templates


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!

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

HUBL If Statements in email templates

Hi @TIDEV,

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

0 Upvotes
TIDEV
Member

HUBL If Statements in email templates

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

0 Upvotes