CMS Development

MFrankJohnson
Thought Leader

HubL Limitations In HubSpot Marketing Emails (HubL Reference)

SOLVE

HubL Limitations In HubSpot Marketing Emails (for Marketing Enterprise)

 

Is there a separate location within the HubL Reference to show what functionality is and is NOT supported in HubSpot email?


We know that using personalization variables (contact and company variables) within if statements is not currently supported for email in HubSpot. (cite: HubL Reference)


Basically, we'd just like to compare personalization tokens or (at least) store their value in a HubL variable for comparision (as a workaround). Would sure save a lot of hoop-jumping! Any ideas?


Appreciate all help. Thanks in advance.

 

Best,

Frank

cc: @jennysowyrda@IsaacTakushi@tjoyce@Stephanie-OG@MayPascaud 

 

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com
0 Upvotes
1 Accepted solution
cbarley
Solution
HubSpot Alumni
HubSpot Alumni

HubL Limitations In HubSpot Marketing Emails (HubL Reference)

SOLVE

Hey @MFrankJohnson , there doesn't appear to be a section devoted to that, but that could certainly make a good addition to our docs. I'll work with our Developer Relations team to see if we can get that implemented. 

 

As for your question, I don't see a way to do this. I just tried tricking HubL into setting a value to a personalization token, and trying to compare the two, but alas, HubL is much smarter than I, so it didn't work. I tried this:

 

{% set variable1 = contact.email %}
{% set variable2 = "test@hubspot.com" %}
{% set variable3 = variable1 %}
<p>
    var3: {{variable3}}
</p>
<p>
    var2: {{variable2}}
</p>
{% if variable3 == variable2 %}
    true
{% else %}
    false
{% endif %}

.... ^ This prints false

At this time, it doesn't look like there's a way to compare contact token values with other values. Hope that answers your question, but let me know if I didn't fully understand you.

View solution in original post

4 Replies 4
cbarley
Solution
HubSpot Alumni
HubSpot Alumni

HubL Limitations In HubSpot Marketing Emails (HubL Reference)

SOLVE

Hey @MFrankJohnson , there doesn't appear to be a section devoted to that, but that could certainly make a good addition to our docs. I'll work with our Developer Relations team to see if we can get that implemented. 

 

As for your question, I don't see a way to do this. I just tried tricking HubL into setting a value to a personalization token, and trying to compare the two, but alas, HubL is much smarter than I, so it didn't work. I tried this:

 

{% set variable1 = contact.email %}
{% set variable2 = "test@hubspot.com" %}
{% set variable3 = variable1 %}
<p>
    var3: {{variable3}}
</p>
<p>
    var2: {{variable2}}
</p>
{% if variable3 == variable2 %}
    true
{% else %}
    false
{% endif %}

.... ^ This prints false

At this time, it doesn't look like there's a way to compare contact token values with other values. Hope that answers your question, but let me know if I didn't fully understand you.

MFrankJohnson
Thought Leader

HubL Limitations In HubSpot Marketing Emails (HubL Reference)

SOLVE

Hey @cbarley, thanks for the reply. Appreciate the effort. You understood perfectly.

 

Think your 2-step method is an excellent example for the dev team as a first stage implementation effort to solve for personalization tokens in email. I'm guessing one of the reasons personalization tokens arent allowed is because of the overhead needed to check for and handle CUSTOM personalization tokens when preparing portal-agnostic email templates. Failure to properly confirm the existence of a personalization token before use might/could/would break the template, so ...

 

None of that risk is involved by using your 2-step method of allowing storage of a personalization token (built-in OR custom) in a HubL variable because even if the personalization token didn't exist the variable would still be defined as blank or null (?), so the template wouldn't 'break'.

 

Again, thanks for the effort and any future coats you may pull to get this on the roadmap. Would save time in use cases where using personalization tokens for data storage is the only option.

 

Best,

Frank

 

-ps

Would be interesting to know if the following also evaluates to false in EMAIL!

{% set variable1 = contact.email %}
{% set variable2 = contact.email %}
<p>
    var1: {{variable1}}
</p>
<p>
    var2: {{variable2}}
</p>
{% if variable1 == variable2 %}
    true
{% else %}
    false
{% endif %}

.... ^ Curious to know if this also evaluates to false within email

 

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com
0 Upvotes
cbarley
HubSpot Alumni
HubSpot Alumni

HubL Limitations In HubSpot Marketing Emails (HubL Reference)

SOLVE

Hi @MFrankJohnson , all fair points , and thanks so much for the input. I'm going to chat with the relevant product team about this and see if I can at least get a reason for why we don't allow this so I can shed some light here. 

 

Turns out that the code you suggested evaluates to true. I assume because both variables are set to the same property on the same object.

 

Screenshot: http://prntscr.com/nj98a0

0 Upvotes
MFrankJohnson
Thought Leader

HubL Limitations In HubSpot Marketing Emails (HubL Reference)

SOLVE

Confirmed {% variable1 == variable2 %&#125; is TRUE!Confirmed {% variable1 == variable2 %} is TRUE!


Ok, so maybe your workaround does work (with limitations). My challenge is/was to store two separate personalization tokens in two separate HubL variables, then compare those variables. Based on your test results, confidence is high that this comparison will yield desired results.


Still interested in knowing what the product team say's ... (just in case we're working with an unsupported 'feature'!) haha 😉


Thanks again, sir. Big help.

 

Best,

Frank

 

Note: Please search for recent posts as HubSpot evolves to be the #1 CRM platform of choice world-wide.

 

Hope that helps.

 

Be well,
Frank


www.mfrankjohnson.com
0 Upvotes