Skip to main content
Legacy quote templates can access quote data and some associated objects directly from the templates. The data available depends on data you have in your CRM, as well as data added to the quote itself. While developing a legacy quote template, you can use HubSpot-provided mock data to populate the template, which may help for previewing the template. In the @hubspot folder, navigate to the cms-quotes-theme folder. Within the templates folder, view the basic.html, modern.html, or original.html templates. These templates contain the following code block at the top:
{% from "../imports/mock_data.html" import SAMPLE_TEMPLATE_DATA as mock_data %}
{% from "../imports/module_defaults.html" import MODULE_DEFAULTS as module_defaults %}
{% set QUOTE = template_data.quote || mock_data.quote %}
{% set CURRENCY = QUOTE.hs_currency || "USD" %}
{% set LOCALE = QUOTE.hs_locale || "en-US" %}
{% set ASSOCIATED_OBJECTS = QUOTE.associated_objects %}
{% set LINE_ITEMS = ASSOCIATED_OBJECTS.line_items %}
{% set ADDITIONAL_FEES = ASSOCIATED_OBJECTS.additional_fees %}
{% set TOTALS = ASSOCIATED_OBJECTS.totals || ASSOCIATED_OBJECTS.totals %}
{% set QUOTE_TOTAL = TOTALS.total %}
{% set SUB_TOTALS = TOTALS.subtotals %}
{% set DEAL = ASSOCIATED_OBJECTS.deal %}
The mock data is first imported from the mock_data.html file, then is set to the QUOTE variable to use the data found in template_data if available. The QUOTE variable is also used to populate the other variables in this list, such as ASSOCIATED_OBJECTS, to make accessing that data less verbose. However, you can structure your data differently, depending on your preferences. In the above code, you’ll notice that template_data is also used to set the main QUOTE variable. template_data is an object containing all of the actual data for the quote and deal in the page. If that object is not found in the template, HubSpot loads the data from mock_data.html instead.

Template data object

The majority of quote data can be directly accessed through the template_data object. You can use {{ template_data|pprint }} in your template to see the full object provided.
VariableTypeDescription
template_datadictA dict containing the quote, quote.associated_objects, and totals dicts.

Quote variables

The information specific to an individual quote. Each variable below should be prepended with template_data.. For example: template_data.quote
VariableTypeDescription
quotedictDict containing all of the data for the quote itself.
quote.associated_objects.deal.hs_object_idIntegerThe ID of the deal associated with the quote.
quote.hubspot_owner_idIntegerThe ID of the deal owner.
quote.hs_all_owner_idsinteger or array of integersThe IDs of all deal owners.
quote.hs_created_by_user_idIntegerUser that created the quote.
quote.hs_lastmodifieddateDatetimeDate the quote was last modified, in epoch format.
quote.hubspot_owner_assigneddateDatetimeDate the quote was assigned an owner, in epoch format.
quote.hs_createdateDatetimeDate and time the quote was created, in epoch format.
quote.hs_expiration_dateDatetimeDate quote expires, in epoch format.
quote.hs_titleStringQuote title
quote.hs_template_typeString"CUSTOMIZABLE_QUOTE_TEMPLATE"
quote.hs_slugStringURL slug for quote web page.
quote.hs_proposal_template_pathStringDeveloper file system path to template, including the file extension.
quote.hs_quote_amountStringThe amount of money set for the quote.
quote.hs_currencyStringCurrency the quote amount is in in 3 character ISO 4217 currency code (e.g., "USD").
quote.hs_languageStringLanguage code (e.g., "en")
quote.hs_localeStringLocale code (e.g., "en-us")
quote.hs_termsStringTerms text provided by quote creator.
quote.hs_sender_firstnameStringFirst name of the person sending the quote.
quote.hs_sender_company_nameStringCompany name of the person sending the quote.
quote.hs_sender_company_image_urlStringCompany logo for the person sending the quote.
quote.hs_statusStringStatus of the quote. (e.g., "APPROVAL_NOT_NEEDED")
quote.hs_primary_colorString/hex color codePrimary color of the quote. (e.g., "#425b76")
quote.hs_quote_numberStringUnique quote ID number.
quote.hs_payment_enabledBooleanUse to test if payment fields need to be shown.
quote.hs_esign_enabledBooleanUse to test if esignature fields need to be shown.

Associated objects

In a quote template, you can access data from a quote’s associated records, such as deals or companies, by using associated_objects. For example, you can add the logo from the quote recipient’s associated company record to a quote by using the following code:
{% set company_avatar_url = template_data.quote.associated_objects.company.hs_avatar_filemanager_key %}
{% if company_avatar_url %}
  <img src="{{ template_data.quote.associated_objects.company.hs_avatar_filemanager_key }}" width="400" alt="{{ template_data.quote.associated_objects.company.name }}">
{% else %}
  <!-- company does not have an assigned image-->
{% endif %}
Please note:Only manually set logos will appear. Automatically detected logos will not appear to prevent unintentional logos from appearing on the quote template.
The above code first sets a variable that searches for the quote’s associated company’s logo. Then, using an if statement, the template displays that logo, if available. If no logo has been manually set for the company, no logo is displayed.

Custom objects

Custom object data can be displayed or used within a quote in a couple different ways. Because each custom object’s structure may vary, you’ll need to get specific properties based on how you’ve structured your custom object. The quote template_data by default has custom associated objects in it. For example, custom objects associated with deals are included. To access them, you can use the following code:
{% set quote_associated_custom_objects = template_data.quote.associated_objects.deal.associated_objects.custom_objects %}

{{ quote_associated_custom_objects|pprint }}
{# |pprint is useful for understanding the structure of the data, you can leave it off when outputting values for display. #}
Because custom objects are unique to each account, the mock data doesn’t include an example custom object. This means that in the template preview in the design manager you may see an error or the custom object data simply won’t display. You’ll instead need to preview the template with your real CRM data, which you can do by creating a quote from the template.
You can then access each custom object type by appending its custom object type ID formatted with underscores. For example: template_data.quote.associated_objects.deal.associated_objects.custom_objects._2_2193031 You can also look up a custom object by using the crm_associations() function and crm_objects() functions. For example, if you wanted to look up a custom object associated with a deal, you could pass in data from template_data:
{% set quote_associated_object = crm_associations(template_data.quote.associated_objects.deal.hs_object_id, "USER_DEFINED", 152) %}
{# 152 is an example of an association type id, you would need to use the appropriate ID for your use-case. #}

{{ quote_associated_object }}