Sales Hub Tools

ChrisChiha
トップ投稿者

Fetching Associated Custom Objects into Quote template

解決

Hello,
 
So i am creating a custom quote template that can be generated from a deal, and that gets populated from the deal itself and the objects associated to it.
 
So far i was able to fetch property value from the deal, company and contact object. (For example contact first name+last name, deal bank name, company name,...)
  
Screen Shot 2022-06-08 at 8.51.32 AM.png
  
But when i try to fetch a certain property value from the custom object associated to the deal, it is not working when i try the same method as the contact and deal object.
 
I was able to fetch all the properties of the associated custom object using the below lines of code:
{% setcustomobject=QUOTE.associated_objects.deal.associated_objects.custom_objects %}

{% for Property in customobject %}
{{ Property }}
{% endfor %}
 Note to avoid confusion: my custom object is named "Property". It refer to a property/house
  
The above line of code returns the following (All the properties in the associated custom object). 
  Screen Shot 2022-06-08 at 8.49.32 AM.png
I almost tried everything to try to fetch only the "property_name" for example, but it wouldn't work. I just want to be able to call only one property value from the associated custom object.
  
Thanks in advance for any input you couple provide.
 
@ChrisChiha 

0 いいね!
1件の承認済みベストアンサー
ChrisChiha
解決策
トップ投稿者

Fetching Associated Custom Objects into Quote template

解決

Hello @TiphaineCuisset ,
 
Please note that i was able to solve the above issue by referencing the custom object type ID found the the index page of the custom object:
 
{% set customobject = template_data.quote.associated_objects.deal.associated_objects.custom_objects.customobjecttypeID %}

元の投稿で解決策を見る

9件の返信
jeremymandle
参加者

Fetching Associated Custom Objects into Quote template

解決

Hi @WPeraltaLópez and @ChrisChiha,

This post helped me greatly.

One thing I just cannot find anywhere, literally anywhere is the syntax for using values from properties of Custom Objects. I can output the properties of the associated Custom Object, but using the same HubL syntax as other OOB modules used by Quote Templates I cannot get values from Custom Object properties to display.

 

I'm trying it like this:

{{ BILLING_ENTITY.billing_entity }}

which should output "HubSpot" for example where HubSpot is the text value of the Custom Object property with the internal name: billing_entity.

 

{# associated company data: name, address, city, state, zip, country #}
{% from '../../imports/mock_data.html' import SAMPLE_TEMPLATE_DATA as mock_data %}
{% set module_data = template_data.module_data %}
{% set QUOTE = template_data.quote || mock_data.quote %}
{% set DEAL = QUOTE.associated_objects.deal %}
{% set BUYER_CONTACTS = QUOTE.associated_objects.contacts %}

{# data to pull from Billing Entities custom object #}
{% set BILLING_ENTITY = template_data.quote.associated_objects.deal.associated_objects.custom_objects._2_17681733 %}

this should display the billing entity name value: {{ BILLING_ENTITY.billing_entity }}
<br />
this should display the billing address line 1 value: {{ BILLING_ENTITY.billing_entity__address_line_1 }}
<br /><br />

{# this is for debugging to prove that the custom object is available #}
{% for billing_entities in BILLING_ENTITY %}
{{ billing_entities }}
{% endfor %}

{% if module.show_billing_entity_name && BILLING_ENTITY.billing_entity %}
<span>
  <b>{{ BILLING_ENTITY.billing_entity }}</b>
</span>
<br>
{% endif %}

 

 

 

0 いいね!
jeremymandle
参加者

Fetching Associated Custom Objects into Quote template

解決

Figured it out. Rookie mistake and I am an uber-rookie at HubSpot.

Forgot to wrap the whole thing in a simple "for" loop like so:

 

{% for billing_entities in BILLING_ENTITY %}
  {{ billing_entities.billing_entity }}
{% endfor %}

 

0 いいね!
WPeraltaLópez
参加者 | Elite Partner
参加者 | Elite Partner

Fetching Associated Custom Objects into Quote template

解決

For example if you custon object ID is:  2_4679355
 you can use:
{% set customobject = template_data.quote.associated_objects.deal.associated_objects.custom_objects._2_4679355 %}

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

Fetching Associated Custom Objects into Quote template

解決

Hi @ChrisChiha 

 

Thank you for reaching out and for all the details!

 

I want to tag some of our experts here - @himanshurauthan @LMeert @miljkovicmisa do you have any advice for @ChrisChiha on this? 

 

Thank you!

Best

Tiphaine


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


0 いいね!
ChrisChiha
解決策
トップ投稿者

Fetching Associated Custom Objects into Quote template

解決

Hello @TiphaineCuisset ,
 
Please note that i was able to solve the above issue by referencing the custom object type ID found the the index page of the custom object:
 
{% set customobject = template_data.quote.associated_objects.deal.associated_objects.custom_objects.customobjecttypeID %}

Gabriel_Guigue
投稿者

Fetching Associated Custom Objects into Quote template

解決

Hello @ChrisChiha 

Sorry for the dummy question, but where do you copy these lines of code, inside your custom Quote template? I mean in which "Container" of the custom Quote template? 
Thanks in advance for your help!

0 いいね!
ChrisChiha
トップ投稿者

Fetching Associated Custom Objects into Quote template

解決

Hello @Gabriel_Guigue ,
 
You can use these lines of codes inside your HTML/Hubl quote template in the design manager tab

Gabriel_Guigue
投稿者

Fetching Associated Custom Objects into Quote template

解決

Thanks a lot @ChrisChiha for your prompt reply.
Inside the design manager, I cannot see the HTML/Hubl quote template. Maybe I'm not looking inside the right place. Could you please share a screenshot?
Thanks.

 

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

Fetching Associated Custom Objects into Quote template

解決

Thank you for sharing this answer @ChrisChiha !


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


0 いいね!