"is containing" does not seem to work when looking at list memberships
Hi @JonSasala I believe this applies to all java hashsets: "JinJava parses a literal number to Long. When testing equality, a Long is not equal to an Integer."
"is containing" does not seem to work when looking at list memberships
Connor, I can confirm this is now working. Thank you!
{% if request.contact.list_memberships is containing 5 %}
You Are Registered
{% else %}
You Are Not Registered, even though these are the lists you are on: {{ request.contact.list_memberships }}
{% endif %}
The fix that was pushed out, can you tell us a bit more about what it achieved? Was it unique to the List Membership property or all java hashset properties?
Jon Sasala (He / Him) President • Hypha HubSpot Development
"is containing" does not seem to work when looking at list memberships
Thanks Connor. I have put this out to the Slack channel and continue to look for alternative ways to change info based on list membership. Looking forward to any fix you may find.
Jon Sasala (He / Him) President • Hypha HubSpot Development
"is containing" does not seem to work when looking at list memberships
Hey @JonSasala, it looks like the request_contact.list_memberships variable is a java hashset (which is iterable, but not filterable) rather than a Pylist, which is what a hubl array produces.
"is containing" does not seem to work when looking at list memberships
Hi @JonSasala, Got it -- I was able to reproduce this. I wonder if the issue has to do with the timing of when the cookie that identifies the contact and when Hubl evaluates the if statement. I'm going to reach out to my team regarding this and I'll let you know what I find!
"is containing" does not seem to work when looking at list memberships
How am I testing this: I am viewing the module on a published page and I am a contact in the database.
If I place {{ request.contact.list_memberships }} on a page and view that page, it will show me, and all visitors, data based on the cookied device the visitor is on. Users who are on any lists will see something like [1, 2, 3]. Users who are unknown would see [ ].
If you view any HubSpot hosted page and look at Developer Info it shows all available data HubSpot has available. When I view that it will show data related to my contact record.
list_membership is not a contact property that we created. It is a default HubSpot contact property that shows the lists, by number, a user is a member of.
When viewing Developer Info it appears like this (for me) on the site I am working on (www.exo.works):
///
{% if request.contact.list_memberships %} This Works! {% endif %}
and I can see that {{ request.contact.list_memberships }} prints [130, 131, 5, 133, 6, 8]
{% if request.contact.list_memberships is containing 5 %} ... {% else %} This Does Not {% endif %}
"is containing" does not seem to work when looking at list memberships
Hi @JonSasala, can you link to the page or module you're working on here? Happy to take a look. From a quick glance, I don't know if the request object is something that HubL can read. Also, the list_memberships property needs to be a contact property in your account for this to work