Sales Hub Tools

ChrisChiha
Top Contributor

Fetching Associated Custom Objects into Quote template

SOLVE

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 Upvotes
2 Accepted solutions
ChrisChiha
Solution
Top Contributor

Fetching Associated Custom Objects into Quote template

SOLVE

Hello @TitiCuisset ,
 
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 %}

View solution in original post

jeremymandle
Solution
Participant | Diamond Partner
Participant | Diamond Partner

Fetching Associated Custom Objects into Quote template

SOLVE

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 %}

 

View solution in original post

0 Upvotes
9 Replies 9
jeremymandle
Participant | Diamond Partner
Participant | Diamond Partner

Fetching Associated Custom Objects into Quote template

SOLVE

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 Upvotes
jeremymandle
Solution
Participant | Diamond Partner
Participant | Diamond Partner

Fetching Associated Custom Objects into Quote template

SOLVE

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 Upvotes
WPeraltaLópez
Participant | Elite Partner
Participant | Elite Partner

Fetching Associated Custom Objects into Quote template

SOLVE

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 Upvotes
TitiCuisset
Community Manager
Community Manager

Fetching Associated Custom Objects into Quote template

SOLVE

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 Upvotes
ChrisChiha
Solution
Top Contributor

Fetching Associated Custom Objects into Quote template

SOLVE

Hello @TitiCuisset ,
 
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
Contributor

Fetching Associated Custom Objects into Quote template

SOLVE

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 Upvotes
ChrisChiha
Top Contributor

Fetching Associated Custom Objects into Quote template

SOLVE

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

Gabriel_Guigue
Contributor

Fetching Associated Custom Objects into Quote template

SOLVE

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 Upvotes
TitiCuisset
Community Manager
Community Manager

Fetching Associated Custom Objects into Quote template

SOLVE

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 Upvotes