CMS Development

pittsburghjoe
Participant | Platinum Partner
Participant | Platinum Partner

Are hubspot lists next to useless when using hubl for emails?

The value that the token gives me is always a hard comma variable and I can't even search it (string_containing) to write some if statements.

 

Here is the deal. I've been asked to utalize a hubspot list (hubspot>Contacts>Lists | smart) that generates what topics a potential lead may be interested in (by visiting certain web pages). Several lists feed into the same token. I need to be able to analize the list and depending on what is listed (value), show specific pdf links that are accociated to the interested topics for an email that will make its way to a sales rep.

 

token

contact.values

below is what the hobspot lists generates as a comma seperated value

Design, Compliant, Hygienic, Sustainable

The problem starts when I can't do something like this

{% if contact.values is string_containing "Hygienic" %}
<a href="some.pdf">pdf</a>
{% endif %}

or this

{% set jobs = [contact.values|split(',')] %} 
{% if jobs is iterable %}
<h3>Available Values</h3>
<ul>
{% for job in jobs %}
    <li>{{ job }}</li>
{% endfor %}
</ul>
{% else %}
<h3>Available Value</h3>
    <div class="single-position">{{ jobs }}</div>
{% endif %}

This ends up giving me one long value that isn't split at all

 

Do you have any idea how to accomplish what I'm trying to do?

 

Edit: I see that {{ content }} has a TYPE of dict 

This variable is a dictionary that stores contact personalization properties for a known contact. Properties can be accessed from this dict, by adding a period and the property name. For example, contact.firstname would print the first name of a contact.

 

Does this somehow explain why I can't can't query multiple content.values ?

Are Dictionary Properies a type that can't be used? Can I change the type to something else so that it can?

3 Replies 3
ReUpEducation
Contributor

Are hubspot lists next to useless when using hubl for emails?

I'm here for the same thing. 2+ years later and still no answer on this. The issue seems to extend beyond just lists to any contact token you're trying to use in a module for email. Here's my code:

{% if contact.other_program %}
  {% set my_content=contact.other_program %}
  {{ my_content }}<br>
  {% if my_content is string %}
    yes, this is a string<br>
    {% if my_content is string_containing "E" %}
      String contains E
    {% else %}
      String does not contain E
    {% endif %}
  {% else %}
    no, this is not a string
  {% endif %}
{% endif %}

This outputs to:

Economics
yes, this is a string
String does not contain E

Huh? So it's a string, as confirmed by the "is string" operator, but I can't use the "is string_containing" operator on it? If I swap out my token with an inline string it works just fine. 

{% if contact.other_program %}
  {% set my_content="Economics" %}
  {{ my_content }}<br>
  {% if my_content is string %}
    yes, this is a string<br>
    {% if my_content is string_containing "E" %}
      String contains E
    {% else %}
      String does not contain E
    {% endif %}
  {% else %}
    no, this is not a string
  {% endif %}
{% endif %}

Output:

Economics
yes, this is a string
String contains E

There's nothing in the documentation that implies there are limitations to where this operator can be used. Is this a failure in documentation or a bug? Modules used in email are already ridiculously limited without being able to use filters. If some operators are off the table too, and undocumented, how are we supposed to do anything except spit back exactly what's in a token?

 

 

 

 

 

AGalit
Member

Are hubspot lists next to useless when using hubl for emails?

I'm having this same issue. I'm using string_containing on a string and it's not working like it should. I have not found a solution for this

EDIT: Just found a solution to this by using the following instead:
{% if 'substring' in string %}

0 Upvotes
nicolebrenner
HubSpot Employee
HubSpot Employee

Are hubspot lists next to useless when using hubl for emails?

Hey @pittsburghjoe, thanks for your post! I haven't seen anything like this before, maybe @Ty @Jsum @dessery might have some insight here?