CMS Development

AZbarouski
Membro

HubL Functions

resolver

Hi!

I have a problem!

I read the info on how to work with crm_associations here https://developers.hubspot.com/docs/cms/hubl/functions. As I see from the documentation there are 3 main properties "idassociation category, association type id".

I know how to use association category and association type id, it's clear. The main problem is in id I want to use it dynamically. I don't have the id of the deal, for example, 1234, I just know the property deal.hs_object_id, and where this property stores. deal.hs_object_id is always different because I sent the email to the different users with different ids.

I want to to use crm_associations like this crm_associations(deal.hs_object_id, 'HUBSPOT_DEFINED', 5), not like this crm_associations(1234, 'HUBSPOT_DEFINED', 5).

 

My question is, how can I use deal.hs_object_id as a variable in the crm_associations function? Is it finally possible?

 

The same problem with crm_object https://developers.hubspot.com/docs/cms/hubl/functions#crm-object , I can't use the query dynamically.

{% set deal = crm_object("deal", deal.hs_object_id) %}

{{ deal }}

 

0 Avaliação positiva
1 Solução aceita
Teun
Solução
Especialista reconhecido(a) | Parceiro Diamante
Especialista reconhecido(a) | Parceiro Diamante

HubL Functions

resolver

Hi @MRenders ,

 

If you activate the programmable email beta for your custom module, then this should work:

{% set lineitems = crm_associations(deal.hs_object_id, "HUBSPOT_DEFINED", 19, "limit=50",
"description,quantity") %}

In my case, I retrieve the associated line items, but you should be able to get different objects this way as well. If you have any bugs with the data or the email, try setting a third param:

{% set lineitems = crm_associations(deal.hs_object_id, "HUBSPOT_DEFINED", 19, "limit=50",
"description,quantity", false) %}

This will give you the unformatted data, which solved a few bugs I had.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


Exibir solução no post original

0 Avaliação positiva
5 Respostas 5
Teun
Especialista reconhecido(a) | Parceiro Diamante
Especialista reconhecido(a) | Parceiro Diamante

HubL Functions

resolver

Hi @AZbarouski ,

I had this working with retrieving associated objects with a contact ID. I used the programmable email beta with a custom module. I first set the contact ID to a custom variable and then used it to retrieve the associated custom objects.
I'll see if I can retrieve the code from an old sandbox.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


MRenders
Participante | Parceiro Platinum
Participante | Parceiro Platinum

HubL Functions

resolver

Hi @Teun

 

Could you provide this code, if you still have it, as an example? I'm also struggeling with this.

 

Thank you 😄

0 Avaliação positiva
Teun
Solução
Especialista reconhecido(a) | Parceiro Diamante
Especialista reconhecido(a) | Parceiro Diamante

HubL Functions

resolver

Hi @MRenders ,

 

If you activate the programmable email beta for your custom module, then this should work:

{% set lineitems = crm_associations(deal.hs_object_id, "HUBSPOT_DEFINED", 19, "limit=50",
"description,quantity") %}

In my case, I retrieve the associated line items, but you should be able to get different objects this way as well. If you have any bugs with the data or the email, try setting a third param:

{% set lineitems = crm_associations(deal.hs_object_id, "HUBSPOT_DEFINED", 19, "limit=50",
"description,quantity", false) %}

This will give you the unformatted data, which solved a few bugs I had.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Avaliação positiva
natsumimori
Gerente da Comunidade
Gerente da Comunidade

HubL Functions

resolver

Thank you @Teun 😄

0 Avaliação positiva
natsumimori
Gerente da Comunidade
Gerente da Comunidade

HubL Functions

resolver

Hi @AZbarouski , thank you for your post.

 

I wanted to tag in @Indra and @miljkovicmisa who have shared great knowledge around Hubl in the Community. Would you be able to weigh in here?

0 Avaliação positiva