Templates

Using Data from Associated Objects New

A Contact, Company, Deal, Ticket, Order or Project template reads its own record and every record associated with it, directly during generation. A Deal template can show the deal's company and contacts, a Contact template can list all of the contact's deals, and so on. Custom objects work too: a Deal template can show its associated custom object, a custom object template can show its deal and contacts, and one custom object can show another. No sync properties or workflows are needed.

You want Write Example
One associated record The object's name and a dot {{company.name}}
Every associated record The name in the plural {{contacts.email}}
The associated deal's products The line items table {{pdf_createmate_line_items}}

Write the placeholder with the object's name in front

Put the associated object's type and a dot before the property name:

Placeholder Shows
{{company.name}} The associated company's name
{{contact.firstname}} The associated contact's first name
{{deal.amount}} The associated deal's amount
{{ticket.subject}} The associated ticket's subject

Formatters work the same way as on any other placeholder, for example {{deal.amount | currency:EUR}} or {{contact.createdate | date:d.m.Y}}. You can also use them in the file name, for example {{company.name}}-offer.

You don't have to type them. In the Prepare Placeholders step, choose the object under Properties of at the top of the property list, for example Company, then search or browse its properties as usual.

Contact, Company, Deal, Ticket, Order and Project templates can each read the other five, plus the custom objects associated with them. The one exception is orders and projects: HubSpot can't associate an order with a project, so an Order template can't read projects and a Project template can't read orders. Placeholders for associated records count toward your template's placeholders like any other placeholder.

When a record has several associated records

A deal can have three contacts. When you pick a property of an associated record, the placeholder settings ask which one to use, for example Which contact? Your choice applies to every placeholder of that object in the template. For PDF form templates, choose it in the Settings step under Associated Records.

  • Primary company - the company HubSpot marks as primary. This is the default for companies.
  • Most recently created - the newest associated record. This is the default for contacts, deals, tickets and custom objects.
  • With label: ... - the record with an association label from your HubSpot account, for example Billing contact. Your labels appear in the list automatically. If more than one record has the label, the most recently created one is used.
For contracts and offers, labels are the most reliable choice. Give the right contact a label like "Billing contact" in HubSpot, choose that label in the template, and the document always addresses the right person.

Every associated record

To use all of them instead of one, write the object's name in the plural:

Placeholder Shows
{{contacts.email}} The e-mail of every associated contact
{{companies.name}} The name of every associated company
{{deals.dealname}} The name of every associated deal
{{tickets.subject}} The subject of every associated ticket

In the placeholder settings, choose All contacts instead of One contact and the builder writes the plural for you. The newest record comes first. If the template's rule is a label, only the records with that label are used, for example all Signer contacts.

In a table, draw the table in your document as usual and put the placeholders in one row:

Name Email Role
{{contacts.firstname}} {{contacts.lastname}} {{contacts.email}} {{contacts.jobtitle}}

When the document is generated, that row is repeated once for every contact, and each copy shows one contact. The table keeps your design: header row, column widths, fonts, colours and borders. If there are no contacts, the row is left out and the header stays. To hide the whole table instead, wrap it in a condition.

Anywhere else, the values are listed and separated by commas: Copies to {{contacts.email}} becomes Copies to laura@brightline.de, jonas@brightline.de.

Works Doesn't
Word, Google Docs and HTML templates PDF form templates
Extra rows above and below the repeated row Two repeated rows in the same table
Several tables in one document Contacts and companies in the same row
Tables that continue onto the next page Alternating row colours: every copy gets the colour of your row

The deal's line items

A contact, company, ticket or project template can also show the products of its associated deal with the {{pdf_createmate_line_items}} table. An order template does not: an order carries its own line items in HubSpot, so an associated deal's products would be the wrong ones. The table uses the same deal as your other deal placeholders. See Deal Line Items.

When there is no associated record

If the record has no associated record of that type, or none with the chosen label, the placeholders stay empty - the same as an empty property - and the document is still generated. With a label, PDF CreateMate never falls back to another record, so the wrong contact never ends up on a contract.

Reading associated records needs HubSpot's permission to read that object. If your connection doesn't have it, those placeholders stay empty too. To grant it, click Reinstall HubSpot App in Settings and approve the permissions HubSpot shows you.

Custom objects

Custom objects are read the same way, using the names you gave the object in HubSpot. If your custom object is called Vehicle (plural Vehicles) and has a property color:

Template Placeholder Shows
Deal, Contact, Company, Ticket, Order or Project {{vehicle.color}} The colour of one associated vehicle
Deal, Contact, Company, Ticket, Order or Project {{vehicles.color}} The colour of every associated vehicle
Vehicle {{deal.dealname}} The name of the vehicle's associated deal
Vehicle {{contacts.email}} The e-mail of every contact associated with the vehicle
Contract (another custom object) {{vehicle.color}} The colour of the contract's associated vehicle

In the builder, the custom object appears under Properties of with its own name, and the placeholder settings ask Which Vehicle? with One Vehicle and All Vehicles. The choices are the same as for contacts: Most recently created or With label: .... Primary company is only available for companies.

A Vehicle template that can read a deal can also show that deal's products with {{pdf_createmate_line_items}}.

What decides which objects you see:

  • The association must exist in HubSpot. A template only offers the custom objects that HubSpot allows to be associated with its object type. You set this up in HubSpot, in the custom object's settings under Associations.
  • Click Sync after a change. If you add a new custom object or a new association in HubSpot, open the Properties page and click Sync.
  • The name comes from HubSpot. The placeholder uses the singular and plural names you entered when you created the object, in lower case, with spaces and special characters turned into _: Service Contract becomes {{service_contract.name}}. If the name is already used by another object, for example a custom object called Contact, the placeholder uses HubSpot's internal name instead, like {{p12345_contact.name}}. The builder always shows the right placeholder.
  • Same singular and plural. If both names are the same, for example News, only One News is offered, because one record and every record would have the same placeholder.
  • Permission. Reading custom objects needs HubSpot's permission to read custom object records. Without it, custom objects aren't offered and their placeholders stay empty. To grant it, click Reinstall HubSpot App in Settings.
Don't see your custom object in the builder? Most often the association is missing in HubSpot. Follow HubSpot's guide Define a custom object's associations to link your custom object to contacts, companies, deals, tickets or another custom object, then click Sync on the Properties page.
A custom object can also read another custom object, for example a Contract template can read its associated Vehicle with {{vehicle.color}}. The association between the two must exist in HubSpot.

Other object types

Templates read associated contacts, companies, deals, tickets, orders, projects and custom objects directly. For a value from any other associated object type, copy it onto your template's object with a HubSpot sync property first:

  1. In HubSpot, create a sync property on your template's object type that pulls the value from the associated object. Follow HubSpot's guide: Create sync properties.
  2. In PDF CreateMate, open the Properties page and click Sync so the new property appears.
  3. Use it in your template like any other property, for example {{contact_email}}.
Video description
- A deal document that needs the contact's email, and the sync-property alternative to reading it with {{contact.email}}
- Creating a Property sync field on the deal in HubSpot that copies the contact's email and keeps it up to date
- Clicking Sync on the Properties page and copying the field name
- Pasting {{contact_email}} into the document and uploading the updated file on the Document step
- The generated PDF with the contact's email filled in