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:
- Verified the existence and correct association of company data in the quote object.
- Ensured that the correct paths and context are used for accessing the data.
- 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:
- What could be the reason that the dynamic variables are not being replaced with the actual data?
- Are there specific HubL tags or filters I should use to ensure the data is correctly rendered?
- 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!