<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic HubL using custom contact properties in if statements in an email template using Design Manager in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/HubL-using-custom-contact-properties-in-if-statements-in-an/m-p/315356#M15097</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use an email template for an email which will be used in a workflow. I created the template using Design Manager.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In contacts I defined prop1 and prop2 properties which are "Single-line text" type. prop1 and prop2 are updated using API calls from our platform and in case these are invalid or not yet set in our platform, I update them with 'N/A' value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In email template I want to show a specific text for prop1 only if prop1 is not 'N/A' and another text if prop2 is not 'N/A'. To achieve this I added following code in email template:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROP1: [{{ contact.prop1 }}]
{% if contact.prop1 != 'N/A' %}
  Property 1 is valid: [{{ contact.prop1 }}]
{% endif %}

PROP2: [{{ contact.prop2 }}]
{% if contact.prop2 != 'N/A' %}
  Property 2 is valid: [{{ contact.prop2 }}]
{% endif %}&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;When I edit the email which uses above email template and go to "Preview", choose a contact which has prop1 set to 'N/A' (without quotes) and prop2 set to 'Something here', the result in the preview is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROP1: [N/A]
  Property 1 is valid: [N/A]

PROP2: [Something here]
  Property 2 is valid: [Something here]&lt;/PRE&gt;&lt;P&gt;I searched other issues related to my problem, I tried using contact.prop1.value, contact.prop1|string != 'N/A'|string to be sure is not something related to prop1 type. Nothing works...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ps. I posted this issue on Email Marketing Tool forum, which might not be appropiate. An admin please delete that post. Thank you!&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jan 2020 13:52:18 GMT</pubDate>
    <dc:creator>andys2p</dc:creator>
    <dc:date>2020-01-29T13:52:18Z</dc:date>
    <item>
      <title>HubL using custom contact properties in if statements in an email template using Design Manager</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubL-using-custom-contact-properties-in-if-statements-in-an/m-p/315356#M15097</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use an email template for an email which will be used in a workflow. I created the template using Design Manager.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In contacts I defined prop1 and prop2 properties which are "Single-line text" type. prop1 and prop2 are updated using API calls from our platform and in case these are invalid or not yet set in our platform, I update them with 'N/A' value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In email template I want to show a specific text for prop1 only if prop1 is not 'N/A' and another text if prop2 is not 'N/A'. To achieve this I added following code in email template:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROP1: [{{ contact.prop1 }}]
{% if contact.prop1 != 'N/A' %}
  Property 1 is valid: [{{ contact.prop1 }}]
{% endif %}

PROP2: [{{ contact.prop2 }}]
{% if contact.prop2 != 'N/A' %}
  Property 2 is valid: [{{ contact.prop2 }}]
{% endif %}&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;When I edit the email which uses above email template and go to "Preview", choose a contact which has prop1 set to 'N/A' (without quotes) and prop2 set to 'Something here', the result in the preview is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROP1: [N/A]
  Property 1 is valid: [N/A]

PROP2: [Something here]
  Property 2 is valid: [Something here]&lt;/PRE&gt;&lt;P&gt;I searched other issues related to my problem, I tried using contact.prop1.value, contact.prop1|string != 'N/A'|string to be sure is not something related to prop1 type. Nothing works...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ps. I posted this issue on Email Marketing Tool forum, which might not be appropiate. An admin please delete that post. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 13:52:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubL-using-custom-contact-properties-in-if-statements-in-an/m-p/315356#M15097</guid>
      <dc:creator>andys2p</dc:creator>
      <dc:date>2020-01-29T13:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: HubL using custom contact properties in if statements in an email template using Design Manager</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubL-using-custom-contact-properties-in-if-statements-in-an/m-p/315546#M15107</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/117393"&gt;@andys2p&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So comparing strings get awkward really fast.&lt;/P&gt;
&lt;P&gt;For starters comparing strings is case sensitive, and this could be your issue.&lt;/P&gt;
&lt;P&gt;Usually you'd want to help avoid human error by converting the case to ensure it's truly the value you're comparing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To remedy try something like:&lt;/P&gt;
&lt;PRE&gt;{% set prop1 = contact.prop1 %}

{% if prop1|upper != 'N/A'%}
  Property 1 is valid: [{{ contact.prop1 }}]
{% endif %}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you continue to see issue please reach out!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2020 22:00:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubL-using-custom-contact-properties-in-if-statements-in-an/m-p/315546#M15107</guid>
      <dc:creator>Kevin-C</dc:creator>
      <dc:date>2020-01-29T22:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: HubL using custom contact properties in if statements in an email template using Design Manager</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubL-using-custom-contact-properties-in-if-statements-in-an/m-p/315634#M15109</link>
      <description>&lt;P&gt;Hi Kevin,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I received an answer in the other thread opened here:&amp;nbsp;&lt;A href="https://community.hubspot.com/t5/Email-Marketing-Tool/HubL-using-custom-contact-properties-in-if-statements-in-an/m-p/315403#M3809" target="_blank"&gt;https://community.hubspot.com/t5/Email-Marketing-Tool/HubL-using-custom-contact-properties-in-if-statements-in-an/m-p/315403#M3809&lt;/A&gt;&amp;nbsp;(again sorry for the duplicate, if an admin can merge these two threads would be perfect).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand string comparison is case sensitive and that's what I expected too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your code like this:&lt;/P&gt;&lt;PRE&gt;{% set n_a = 'N/A' %}
{% set prop1 = contact.prop1 %} {# prop1 is 'N/A' #}
{% set prop2 = contact.prop2 %} {# prop2 is 'Something here' #}

Prop1: [{{ prop1 }}]
{% if prop1|upper != n_a %}
  &amp;lt;li&amp;gt;Prop1: [{{ prop1 }}]&amp;lt;/li&amp;gt;
{% endif %}

Prop2: [{{ prop2 }}]
{% if prop2|upper != n_a %}
  &amp;lt;li&amp;gt;Prop2: {{ prop2 }}&amp;lt;/li&amp;gt;
{% endif %}&lt;/PRE&gt;&lt;P&gt;and the result:&lt;/P&gt;&lt;PRE&gt;Prop1: [N/A]
  Prop1: [N/A]

Prop2: [Something here]
  Prop2: [Something here]&lt;/PRE&gt;&lt;P&gt;so basically if statements are not supported yet in email templates, but only in CMS and Blog pages.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone having this issues please upvote these ideas (as&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/1377"&gt;@MatthewShepherd&lt;/a&gt;&amp;nbsp;mentioned in the other thread):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hubspot.com/t5/HubSpot-Ideas/if-statements-in-email-templates/idi-p/282907" target="_blank"&gt;https://community.hubspot.com/t5/HubSpot-Ideas/if-statements-in-email-templates/idi-p/282907&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hubspot.com/t5/HubSpot-Ideas/If-Statements-in-HubL-for-Email-Templates/idi-p/216789" target="_blank"&gt;https://community.hubspot.com/t5/HubSpot-Ideas/If-Statements-in-HubL-for-Email-Templates/idi-p/216789&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 09:16:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubL-using-custom-contact-properties-in-if-statements-in-an/m-p/315634#M15109</guid>
      <dc:creator>andys2p</dc:creator>
      <dc:date>2020-01-30T09:16:44Z</dc:date>
    </item>
  </channel>
</rss>

