CMS Development

tmcmillan99
Contributor | Elite Partner
Contributor | Elite Partner

CRM_Objects results list if field matches specific value

SOLVE

My example custom object has a category field that contains a dropdown of 5 options - cat1,cat2,cat3,cat4, & cat5.

 

I am having trouble getting the if statement syntax correct so that it will only list results when the category field matches the speficied value.

{% set member = contact.email %}
{% set items = crm_objects("member_resources", "member_email=" + member, "category,notes,link") %}

<ul>
{% if items.category == "cat1" %}
{% for item in items.results %}
<li>{{ item.notes }}</li>
{% endfor %}
{% endif %}
</ul>

How do I correct the if statement so that I only see results that match the "cat1" category?

 

Thanks,

Terry McMillan

0 Upvotes
1 Accepted solution
tmcmillan99
Solution
Contributor | Elite Partner
Contributor | Elite Partner

CRM_Objects results list if field matches specific value

SOLVE

@dennisedson @Kevin-C

I was able to resolve my issue using an example from one of Kevin's previous solutions.

https://community.hubspot.com/t5/CMS-Development/Checking-for-multiple-values-in-an-if-statement/m-p...

 

Thanks,

Terry

View solution in original post

2 Replies 2
tmcmillan99
Solution
Contributor | Elite Partner
Contributor | Elite Partner

CRM_Objects results list if field matches specific value

SOLVE

@dennisedson @Kevin-C

I was able to resolve my issue using an example from one of Kevin's previous solutions.

https://community.hubspot.com/t5/CMS-Development/Checking-for-multiple-values-in-an-if-statement/m-p...

 

Thanks,

Terry

dennisedson
HubSpot Product Team
HubSpot Product Team

CRM_Objects results list if field matches specific value

SOLVE

@Kevin-C , any guiding light you can provide? 🔦

0 Upvotes