# Dynamic Filtering using GraphQL in programmatic emails

**URL:** <https://community.hubspot.com/t/dynamic-filtering-using-graphql-in-programmatic-emails/79680>\
**Category:** HubSpot Ideas\
**Tags:** design-manager, api, object\
**Created:** [April 19, 2023, 8:40pm UTC](https://community.hubspot.com/t/dynamic-filtering-using-graphql-in-programmatic-emails/79680 "2023-04-19T20:40:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JBrake](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jbrake/32/76513_2.png) [@JBrake](https://community.hubspot.com/u/JBrake)\
**Post date:** [April 19, 2023, 8:40pm UTC](https://community.hubspot.com/t/dynamic-filtering-using-graphql-in-programmatic-emails/79680/1 "2023-04-19T20:40:50Z")

</div>

It would be great to be able to use GraphQL to load dynamic content in email templates.

For example, I have an Email that has be triggered by a deal in a workflow. In that deal is a custom object, lets say an Event. I would like the details of said event to appear on the email loaded via the triggering deal, and the Event ID in the deal and not by association.

{% set event = data\_query.data.CRM.Event($id=

personalization\_token(‘deal.event\_id’, ‘0’)

) %}  
or,

In an e-commerce email triggered by a deal, a list of related products based on filters created by line items in the deal. AKA “You may also like” or “Other customers also bought”.

{% set relatedProducts = data\_query.data.CRM.ProductListFilter(

filter: {product\_category\_\_in: [“pet food”,“flea treatment”]) %}

Regards,

Jonathan

---

<div class="post-metadata">

**Author:** ![nznicko](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nznicko/32/21752_2.png) [@nznicko](https://community.hubspot.com/u/nznicko)\
**Post date:** [April 19, 2023, 9:29pm UTC](https://community.hubspot.com/t/dynamic-filtering-using-graphql-in-programmatic-emails/79680/2 "2023-04-19T21:29:51Z")

</div>

Yes please!!

---

<div class="post-metadata">

**Author:** ![romi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/romi/32/78601_2.png) [@romi](https://community.hubspot.com/u/romi)\
**Post date:** [April 20, 2023, 5:57am UTC](https://community.hubspot.com/t/dynamic-filtering-using-graphql-in-programmatic-emails/79680/3 "2023-04-20T05:57:45Z")

</div>

This is critical for for building out more sophisticated email campaigns and solutions.

---

<div class="post-metadata">

**Author:** ![MFall13](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mfall13/32/10691_2.png) [@MFall13](https://community.hubspot.com/u/MFall13)\
**Post date:** [July 10, 2024, 5:05pm UTC](https://community.hubspot.com/t/dynamic-filtering-using-graphql-in-programmatic-emails/79680/4 "2024-07-10T17:05:15Z")

</div>

+1, interested for the purposes of more easily querying the CRM with greater complexity rather than doing it with crm\_associations and crm\_objects functions, plus the 5 calls to crm\_ functions per programmable email documentation is too limiting.
