CMS Development

AZbarouski
メンバー

HubL Functions

解決

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 いいね!
1件の承認済みベストアンサー
Teun
解決策
名誉エキスパート | Diamond Partner
名誉エキスパート | Diamond Partner

HubL Functions

解決

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 いいね!
5件の返信
Teun
名誉エキスパート | Diamond Partner
名誉エキスパート | Diamond Partner

HubL Functions

解決

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
参加者 | Platinum Partner
参加者 | Platinum Partner

HubL Functions

解決

Hi @Teun

 

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

 

Thank you 😄

0 いいね!
Teun
解決策
名誉エキスパート | Diamond Partner
名誉エキスパート | Diamond Partner

HubL Functions

解決

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 いいね!
natsumimori
コミュニティーマネージャー
コミュニティーマネージャー

HubL Functions

解決

Thank you @Teun 😄

0 いいね!
natsumimori
コミュニティーマネージャー
コミュニティーマネージャー

HubL Functions

解決

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 いいね!