Email Marketing Tool

KimM
Top Contributor

Struggling with Programmable Email Beta - Conditional Logic

SOLVE

I have signed up for the Programmable Email Beta and wanting to create an email that checks a contact property (contact.sessions_registered_2021) and displays a certain table row depending on what values it holds. The property is a multiple select property with options being (Session 1, Session 2, Session 3).

 

I've added a sample of what I've got below so far below, but I cannot get it to work. I'm not a developer and there is limited documentation on this as it's still in Beta, Hubspot support has been a bit slow as well, so hoping someone in the community might be able to help me.

 

<table width="100%">
<tbody>
<tr>
<th colspan="3" style="background-color:#0094d3; padding:5px;">
<p style="color:#fff;text-align:left;font-family:rubik;font-size:13px">Monday</p>
</th>
</tr>
{% if contact.sessions_registered_2021 is containing 'Session 1' %}
<tr>
<td width="18%">
<p style="text-align:left;font-family:rubik;font-size:12px;">Session 1 Details</p>
</td>
</tr>
{% endif %}
{% if contact.sessions_registered_2021 is containing 'Session 2' %}
<tr>
<td width="18%">
<p style="text-align:left;font-family:rubik;font-size:12px;">Session 2 Details</p>
</td>
</tr>
{% endif %}
<tr>
<th colspan="3" style="background-color:#0094d3; padding:5px;">
<p style="color:#fff;text-align:left;font-family:rubik;font-size:13px">Tuesday</p>
</th>
</tr>
{% if contact.sessions_registered_2021 is containing 'Session 3' %}
<tr>
<td width="18%">
<p style="text-align:left;font-family:rubik;font-size:12px;">Session 3 Details</p>
</td>
</tr>
{% endif %}
</tbody>
</table>

 Any guidance would be so helpful. Thanks in advance.

0 Upvotes
1 Accepted solution
KimM
Solution
Top Contributor

Struggling with Programmable Email Beta - Conditional Logic

SOLVE

Hi Indra,

 

I'm afraid this doesn't solve the issue as the property is a multiple select, so I need to use the 'containing' expression.

 

However, I have found the solution to the problem now thanks to Hubspot support. I wasn't actually accessing the value when writing the statement. So instead of: 

{% if contact.sessions_registered_2021 is containing 'Session 1' %}

it should be:

{% if contact.sessions_registered_2021.value is containing 'Session 1' %}

 

Thanks to Hubspot support for looking into this for me. I imagine this will become a lot more clear in the documentation once the product is out of beta. 

View solution in original post

3 Replies 3
Indra
Guide | Elite Partner
Guide | Elite Partner

Struggling with Programmable Email Beta - Conditional Logic

SOLVE

@natsumimori thanks for mentioning.

 

Hi @KimM did you check the output {{ contact.sessions_registered_2021 }} of your variable.

Perhaps you can check out other conditinal logics from the Operators & Expression and  like: 

{% if contact.sessions_registered_2021 == 'Session 1' %}

 

 


Indra Pinsel - Front-end developer - Bright Digital
Did my answer solve your issue? Help the community by marking it as the solution.
KimM
Solution
Top Contributor

Struggling with Programmable Email Beta - Conditional Logic

SOLVE

Hi Indra,

 

I'm afraid this doesn't solve the issue as the property is a multiple select, so I need to use the 'containing' expression.

 

However, I have found the solution to the problem now thanks to Hubspot support. I wasn't actually accessing the value when writing the statement. So instead of: 

{% if contact.sessions_registered_2021 is containing 'Session 1' %}

it should be:

{% if contact.sessions_registered_2021.value is containing 'Session 1' %}

 

Thanks to Hubspot support for looking into this for me. I imagine this will become a lot more clear in the documentation once the product is out of beta. 

natsumimori
Community Manager
Community Manager

Struggling with Programmable Email Beta - Conditional Logic

SOLVE

Thank you for your post @KimM .

 

@JBeatty and @Indra , is this something you have experience with?