Help Needed with HubSpot Quote Template: Dynamic Company Information Not Rendering

Hello HubSpot Community,

I’m currently working on customizing a quote template in HubSpot and I’m facing issues with rendering dynamic company information. I need to display the buyer company’s details within the “Scope of Products and Services” section of the quote.

{% 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 BUYER_COMPANY = QUOTE.associated_objects.company %}
{% set BUYER_CONTACTS = QUOTE.associated_objects.contacts %}

<div class="container">
 {% module "scope_of_products_and_services" 
 label="Scope of Products and Services" 
 path="@hubspot/rich_text", 
 html="
 <h2>Scope of Products and Services</h2>
 <p>This Quotation (the 'Quotation') is entered between X Ltd., a company incorporated under the laws of state of USA, with registration #, having its principal office at XYZ St., NY (the 'Company') and {{ BUYER_COMPANY.name }}, a company incorporated under the laws of state of USA, with registration # {{ BUYER_COMPANY.registration_number }}, having its principal office at:</p>
 <address style='font-style: normal'>
 {{ BUYER_COMPANY.address }}<br>
 {{ BUYER_COMPANY.city }}, {{ BUYER_COMPANY.state }} {{ BUYER_COMPANY.zip }}<br>
 {{ BUYER_COMPANY.country }}
 </address>
 <p>(the 'Customer').</p>
 <p>The Effective Date of this Quotation: {{ QUOTE.hs_createdate | format_date('DD/MM/YYYY') }}</p>
 " 
 %}
</div>

Despite my efforts, the dynamic variables (e.g., {{ BUYER_COMPANY.name }}, {{ BUYER_COMPANY.registration_number }}, etc.) are not being replaced with the actual data from the associated company. Instead, they are being rendered as plain text.

What I’ve Tried:

  1. Verified the existence and correct association of company data in the quote object.
  2. Ensured that the correct paths and context are used for accessing the data.
  3. Removed sanitize_html and other filters to simplify the rendering logic.

Context:

  • I am using the HubSpot CMS for managing and customizing the quote templates.
  • The goal is to dynamically populate the buyer company’s information in the generated quote based on the associated company data in the quote object.

Questions:

  1. What could be the reason that the dynamic variables are not being replaced with the actual data?
  2. Are there specific HubL tags or filters I should use to ensure the data is correctly rendered?
  3. Has anyone successfully implemented a similar customization and could share their approach or code snippet?

Any insights or solutions to help resolve this issue would be greatly appreciated.

Thank you in advance for your assistance!

Hey @TPesach3

Is the quote you’re testing associated to multiple companies by chance?

If so it may be because the “QUOTE.associated_objects.company” is returning an array. Try “QUOTE.associated_objects.company[0]” and see if you get any results.

I’ve tried it with one associated company :confused: