0

I'm trying to show specific content if a user is part of a list in HubSpot.

Psuedo:

If contact_id is part_of_this_list then do this

The contact ID at the moment is being obtained from the query string. I'm trying to check if the user is part of said list, but it's not working.

Approach:

{% set id_querystring = request.query_dict.id %}
{% set registration_list_id = "6136" %} <!-- id of the list I'm checking -->

{% if id_querystring in registration_list_id %}
 contact is part of list
{% else %}
 contact is not part of list
{% endif %}
Freddy
  • 683
  • 4
  • 35
  • 114
  • Try using [`dump()`](https://twig.symfony.com/doc/2.x/functions/dump.html) on `request.query_dict.id` so we have an idea of that variable structure and post it in your question. – β.εηοιτ.βε Aug 03 '20 at 18:05

1 Answers1

1

i use this code:

{% set list_variable = request_contact.list_memberships|pprint %}
{% if "id of the list you are checking" in list_variable %} ← without the quotes

yes, you are in the list

{%else%}

No, you are not in the list

{%endif%}