Get Custom Objects associated to a contact?


I see there is a way to get all contacts associated to a custom object using CRM Associations:



{% set associated_objects = crm_associations(289236, "USER_DEFINED", 3) %}
<h3>Contacts Associated With Event</h3>
{% for contact in associated_objects.results %}
	<li>Name: {{ contact.firstname }} {{ contact.lastname }}</li>
{% endfor %} 



But how do i do the *opposite*? I want all of the properties of a specific custom object  type associated to a single user. I want to display these properties (there may be one or more associated to the user) to be shown in an email.

2 Replies 2
Recognized Expert | Platinum Partner

Hi @ccbayer,


I think I understand your question...but maybe not entirely. Could you potentially use a workflow to set the values of the custom object? Your enrollment criteria could be that the values are unknown on the object and the contact meets X criteria.


Here's an article. You can then use the data from the custom object properties in marketing emails



Did this post help solve your problem? If so, please mark it as a solution.

Josh Curcio

HubSpot support and inbound marketing for OEMs, contract manufacturers, and industrial suppliers.
HubSpot Platinum Partner & HubSpot Certified Trainer




Thanks! Those articles got me a bit more traction - the automated trigger for the email will be based on values in the custom object (expiration date - contact will get an email when they are within 30 days of this date), but we need to actually display the custom object's properties inside the email that gets sent. That's the part i'm stuck on.


In the "send email" portion of this automation workflow, I can create tokens that display these properties in a rich text field for my email -- but i would rather be able to create an email module that is custom designed that allows me to loop over each custom object associated with a particular contact and display some of the properties. I don't see a way to choose, create, or edit the template that gets sent in the automated workflow. 


The reason why I'd like to have more control over formatting is that the custom object's properties can have a many-to-one relationship and it would be nice to have more control over the layout / formatting of the properties instead of just a list.


even if we can't get deep access to the object and use HUBL tags to construct our own layout, i would at least like to format the email in some fashion.