CMS Development

JustinDowty
Participant | Diamond Partner
Participant | Diamond Partner

Using the crm_associations hubl function with contact id in email module

I have tested my use case of crm_associations with a test value and that is not the issue. This works as expected:

 

{% set associated_objects = crm_associations(12345, "USER_DEFINED", 123) %}

 

However passing the contact id to this method has not worked.

 

Here are a few things I have tried:

{% set contact_id = contact_without_defaults.hs_object_id %} - this prints as the correct contact id

{% set contact_id = contact_without_defaults.hs_object_id|int %} - this prints as 0

{% set contact_id = contact.hubspot_contact_record %} - I have tried this along with split and replace to get the end part which is the id, which doesn't work, so I would try to cast that to int but split and replace don't work, even after casting to string

{% set contact_id = contact.contact_vid %} - this seems to exist only on pages and not in email modules

 

Are there any other ways to obtain the contact id and pass it to a method within an email template?

 

0 Upvotes
Kevin-C
Recognized Expert | Partner
Recognized Expert | Partner

Using the crm_associations hubl function with contact id in email module

Hey @JustinDowty 

 

Have you tried "contact.id"? I've found that sometimes "hs_object_id" works and other you need to use "id". I'm sure there is a logical reason for that but I haven't found the time to test it.

JustinDowty
Participant | Diamond Partner
Participant | Diamond Partner

Using the crm_associations hubl function with contact id in email module

Hey @Kevin-C 

 

Yes I have tried that as well. I have tried what feels like every way I could possibly come up with. Is this possibly a bug that needs to be reported? It seems to me like this use case would be a common one for the crm_associations function.

 

My use case is for an email module that will display the travel agent information assigned to each recipient of an email. This might be a make or break thing for setting up this clients email marketing system.

0 Upvotes