Hey there!
We’re trying to create a workflow in HubSpot that allows us to send product recommendations based on a common attribute between deals and products, but we’re struggling to implement it.
Workflow Objective:
Type: Deal-based.
The goal is to send an email with a list of 3 recommended products, which should be dynamic and depend on the deal in question.
Example: For Deal A, the recommended products could be 1, 2, 3; for Deal B: 5, 6, 7. Deal A matches with Product 1,2,3 by the custom property, same for Deal B and products 5,6,7
Current Setup:
Deals have a custom property called “creator_slug.”
Products also have the custom property "creator_slug.
We want to link the products to the deals using this property and display the top 3 products
Current Progress:
We’ve tried several approaches, but the closest we’ve come to a solution is by creating a custom template in Content > Design Manager with the following code:
{% set key = "limit=3&creator_slug__eq=" ~ deal.creator_slug %}
{{ key }} -- the string is evaluated correctly and is valid
{% set objects = crm_objects("product", key, "name,creator_slug") %}
{% for product in objects.results %}
<p>{{ product.name }} - {{product.creator_slug}}</p>
{% endfor %}
The issue we’re facing is that when we try to use the dynamic key value to filter the products, no results are returned. It seems like crm_objects is evaluated before the key is generated, so the query doesn’t return any results. However, when we switch the query to a static value like:
crm_objects("product", "limit=3&creator_slug__eq=myslug", "name,creator_slug")
we do get the correct products.
Is there any way we can use the dynamic property in the query to get the products that match the current deal’s “creator_slug”?
Could you guide us on how to achieve this? If there’s any other alternative approach to achieve the same goal, we’d love to hear about it, as we’re a bit stuck at the moment.
Thanks a lot for your help!
