# CRM Object Filtering

**URL:** <https://community.hubspot.com/t/crm-object-filtering/73143>\
**Category:** CMS Development\
**Tags:** professional\
**Created:** [January 18, 2023, 4:12am UTC](https://community.hubspot.com/t/crm-object-filtering/73143 "2023-01-18T04:12:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke-Simp](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/luke-simp/32/74544_2.png) [@Luke-Simp](https://community.hubspot.com/u/Luke-Simp)\
**Post date:** [January 18, 2023, 4:12am UTC](https://community.hubspot.com/t/crm-object-filtering/73143/1 "2023-01-18T04:12:59Z")

</div>

Hi hubspot community,

Trying to filter my object records by type of publication. Did this a very repetitive way that worked but then hit the CRM object call limit so had to work out how to consolidate the code.

Stuck on trying to filter results further and came up with {% set associated\_objects(“type\_of\_publication=Book Chapter”) %} but I feel like this is wrong. Assume this is something easy to fix. At the moment the code is just outputting all the records associated with the person and using the first filter but not including the filter in the second “set”.

Sample code for first two publication types below.

Appreciate the support. Thanks in advance. 😊

```lia-code-sample
 <h5>Research Publications</h5>
{% set associated_objects = crm_associations(module.person.id, "USER_DEFINED", 209, "research_or_scholarship_publication_=Research Publication&visible_publication=true&orderBy=-year_published", "publication_title, year_published, books_book_chapters_music __publisher_name_and_place, name_of_author_s_, book_chapter__ book_name, book_chapters_journals __page_numbers, journal__ name, journal __volume_and_issue, publication_external_link, conference_creative_performance__ name_of, conference_creative_performance__location") %} 
<h6>Books</h6>
{% for ac_profiles in associated_objects.results %} {% set associated_objects("type_of_publication=Books") %}
	{{ac_profiles.name_of_author_s_}} ({{ac_profiles.year_published}}). <em>{{ ac_profiles.publication_title }}</em>. {{ac_profiles.books_book_chapters_music__publisher_name_and_place}}<br> 
{% endfor %}
<br>
<h6>Book Chapters</h6>
{% for ac_profiles in associated_objects.results %} {% set associated_objects("type_of_publication=Book Chapter") %}
{{ac_profiles.name_of_author_s_}} ({{ac_profiles.year_published}}). <em>{{ ac_profiles.publication_title }}</em> in {{ ac_profiles.book_chapter__book_name}} (pp.{{ac_profiles.book_chapters_journals__page_numbers}}). {{ac_profiles.books_book_chapters_music__publisher_name_and_place}}<br>
{% endfor %}

```

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [January 18, 2023, 7:52pm UTC](https://community.hubspot.com/t/crm-object-filtering/73143/2 "2023-01-18T19:52:34Z")

</div>

Hi, @Luke-Simp 👋 Thanks for reaching out! Hey, @Stephanie-OG @Anton, do you have any tips you can share with @Luke-Simp?

Thank you very much for taking a look! — Jaycee

---

<div class="post-metadata">

**Author:** ![Luke-Simp](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/luke-simp/32/74544_2.png) [@Luke-Simp](https://community.hubspot.com/u/Luke-Simp)\
**Post date:** [February 20, 2023, 5:36am UTC](https://community.hubspot.com/t/crm-object-filtering/73143/3 "2023-02-20T05:36:13Z")

</div>

Thanks [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074). Still having issues when I’m combining multiple modules and hitting crm\_associations call limit with this so if anyone is able to give insight that would be awesome!

Here’s the latest code. Would love to just do one call for the whole “Scholarships” section and then just filter by “type\_of\_publication” to show the different results for each subheading.

Appreciate any feedback.

```lia-code-sample
<details>
 <summary>
 <h5>Scholarship</h5>
 <div class="chevron-icon"></div>
 </summary>
 <div class="content-wrapper">
 {% if dynamic_page_crm_object %}
{% set associated_objects = crm_associations(dynamic_page_crm_object.id, "USER_DEFINED", 211, "research_or_scholarship_publication_=Scholarship Publication&type_of_publication=Book&visible_publication=true&orderBy=-year_published", "publication_title, year_published, books_book_chapters_music __publisher_name_and_place, name_of_author_s_, book_chapter__ book_name, book_chapters_journals __page_numbers, conference_creative_performance__ name_of, conference_creative_performance __location, publication_external_link, journal__ name, journal__volume_and_issue") %}
 <h6>Books</h6>
{% for ac_profiles in associated_objects.results %}
	{{ac_profiles.name_of_author_s_}} ({{ac_profiles.year_published}}). <em>{{ ac_profiles.publication_title }}</em>. {{ac_profiles.books_book_chapters_music__publisher_name_and_place}}<br> 
{% endfor %} 
<br>
{% set associated_objects = crm_associations(dynamic_page_crm_object.id, "USER_DEFINED", 211, "research_or_scholarship_publication_=Scholarship Publication&type_of_publication=Book chapter&visible_publication=true&orderBy=-year_published", "publication_title, year_published, books_book_chapters_music __publisher_name_and_place, name_of_author_s_, book_chapter__ book_name, book_chapters_journals __page_numbers, conference_creative_performance__ name_of, conference_creative_performance __location, publication_external_link, journal__ name, journal__volume_and_issue") %}
 <h6>Book Chapters</h6>
{% for ac_profiles in associated_objects.results %} 
{{ac_profiles.name_of_author_s_}} ({{ac_profiles.year_published}}). <em>{{ ac_profiles.publication_title }}</em> in {{ ac_profiles.book_chapter__book_name}} (pp.{{ac_profiles.book_chapters_journals__page_numbers}}). {{ac_profiles.books_book_chapters_music__publisher_name_and_place}}<br>
{% endfor %} 
<br>
{% set associated_objects = crm_associations(dynamic_page_crm_object.id, "USER_DEFINED", 211, "research_or_scholarship_publication_=Scholarship Publication&type_of_publication=Book Review&visible_publication=true&orderBy=-year_published", "publication_title, year_published, books_book_chapters_music __publisher_name_and_place, name_of_author_s_, book_chapter__ book_name, book_chapters_journals __page_numbers, conference_creative_performance__ name_of, conference_creative_performance __location, publication_external_link, journal__ name, journal__volume_and_issue") %} 
 <h6>Book Reviews</h6>
{% for ac_profiles in associated_objects.results %} 
	{{ac_profiles.name_of_author_s_}} ({{ac_profiles.year_published}}). <em>{{ ac_profiles.publication_title }}</em>. {{ac_profiles.books_book_chapters_music__publisher_name_and_place}}<br> 
{% endfor %} 
<br>
{% set associated_objects = crm_associations(dynamic_page_crm_object.id, "USER_DEFINED", 211, "research_or_scholarship_publication_=Scholarship Publication&type_of_publication=Creative Production or Composition&visible_publication=true&orderBy=-year_published", "publication_title, year_published, books_book_chapters_music __publisher_name_and_place, name_of_author_s_, book_chapter__ book_name, book_chapters_journals __page_numbers, conference_creative_performance__ name_of, conference_creative_performance __location, publication_external_link, journal__ name, journal__volume_and_issue") %}
 <h6>Creative Productions or Compositions</h6>
 {% for ac_profiles in associated_objects.results %} 
 {{ac_profiles.name_of_author_s_}} ({{ac_profiles.year_published}}). <em>{{ ac_profiles.publication_title }}</em>. {{ac_profiles.books_book_chapters_music __publisher_name_and_place}} {{ac_profiles.conference_creative_performance__ location}}<br>
{% endfor %} 
<br>
{% set associated_objects = crm_associations(dynamic_page_crm_object.id, "USER_DEFINED", 211, "research_or_scholarship_publication_=Scholarship Publication&type_of_publication=Edited Collection of Essays&visible_publication=true&orderBy=-year_published", "publication_title, year_published, books_book_chapters_music __publisher_name_and_place, name_of_author_s_, book_chapter__ book_name, book_chapters_journals __page_numbers, conference_creative_performance__ name_of, conference_creative_performance __location, publication_external_link, journal__ name, journal__volume_and_issue") %}
 <h6>Edited Collections of Essays</h6>
 {% for ac_profiles in associated_objects.results %}
 {{ac_profiles.name_of_author_s_}} ({{ac_profiles.year_published}}). <em>{{ ac_profiles.publication_title }}</em>. {{ac_profiles.books_book_chapters_music__publisher_name_and_place}}<br>
{% endfor %} 
<br>
{% set associated_objects = crm_associations(dynamic_page_crm_object.id, "USER_DEFINED", 211, "research_or_scholarship_publication_=Scholarship Publication&type_of_publication=Journal article&visible_publication=true&orderBy=-year_published", "publication_title, year_published, books_book_chapters_music __publisher_name_and_place, name_of_author_s_, book_chapter__ book_name, book_chapters_journals __page_numbers, conference_creative_performance__ name_of, conference_creative_performance __location, publication_external_link, journal__ name, journal__volume_and_issue") %}
<h6>Journal Articles</h6>
 {% for ac_profiles in associated_objects.results %}
 {{ac_profiles.name_of_author_s_}} ({{ac_profiles.year_published}}). {{ ac_profiles.publication_title }}. <em>{{ac_profiles.journal __name}}</em>, {{ac_profiles.journal__ volume_and_issue}}, {{ac_profiles.book_chapters_journals__page_numbers}} | <a href="{{ac_profiles.publication_external_link}}">External Link</a><br>
{% endfor %} 
<br>
{% set associated_objects = crm_associations(dynamic_page_crm_object.id, "USER_DEFINED", 211, "research_or_scholarship_publication_=Scholarship Publication&type_of_publication=Popular article&visible_publication=true&orderBy=-year_published", "publication_title, year_published, books_book_chapters_music __publisher_name_and_place, name_of_author_s_, book_chapter__ book_name, book_chapters_journals __page_numbers, conference_creative_performance__ name_of, conference_creative_performance __location, publication_external_link, journal__ name, journal__volume_and_issue") %}
<h6>Popular Articles</h6>
 {% for ac_profiles in associated_objects.results %}
 {{ac_profiles.name_of_author_s_}} ({{ac_profiles.year_published}}). {{ ac_profiles.publication_title }}. <em>{{ac_profiles.journal__name}}</em> | <a href="{{ac_profiles.publication_external_link}}">External Link</a><br>
{% endfor %} 
<br>
{% set associated_objects = crm_associations(dynamic_page_crm_object.id, "USER_DEFINED", 211, "research_or_scholarship_publication_=Scholarship Publication&type_of_publication=Other publications&visible_publication=true&orderBy=-year_published", "publication_title, year_published, books_book_chapters_music __publisher_name_and_place, name_of_author_s_, book_chapter__ book_name, book_chapters_journals __page_numbers, conference_creative_performance__ name_of, conference_creative_performance __location, publication_external_link, journal__ name, journal__volume_and_issue") %}
<h6>Other Publications</h6>
 {% for ac_profiles in associated_objects.results %}
 {{ac_profiles.name_of_author_s_}} ({{ac_profiles.year_published}}). <em>{{ ac_profiles.publication_title }}</em>. {{ac_profiles.books_book_chapters_music__publisher_name_and_place}} | <a href="{{ac_profiles.publication_external_link}}">External Link</a><br>
{% endfor %} 

 {% endif %}
 </div>
 </details>

```
