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,...)
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).
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.
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 %}
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 %}
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!
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.