Struggling with Programmable Email Beta - Conditional Logic

KimM
Contributeur de premier rang

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 Votes
1 Solution acceptée
KimM
Solution
Contributeur de premier rang

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. 

Voir la solution dans l'envoi d'origine

3 Réponses 3
Indra
Guide | Partenaire solutions Elite
Guide | Partenaire solutions Elite

@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
Contributeur de premier rang

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
Gestionnaire de communauté
Gestionnaire de communauté

Thank you for your post @KimM .

 

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