How tokens work — basics, lookups, multi-hop, format hints
Tokens are {{column}} placeholders in your branded Word file. Templ8r reads bound Dataverse fields at generate-time and splices values back in. Supports lookups, multi-hop chains, repeating rows, format hints, and conditionals.
A token is a placeholder you type into your Word document. When generation runs, Templ8r reads the bound Dataverse columns and replaces each token with the live value. There's no merge plumbing on your side — the engine, bindings, and merge live in our API.
Full reference with worked examples: /templates/authoring. This article is the tl;dr for someone bringing their own template.
The simplest token
Drop {{ordernumber}} directly into your Word document where you want the order number to appear. On generation the token is replaced with the field's value — e.g. ORD-01000-M9B3M3.
Format hints
Two equivalent syntaxes — pick whichever feels natural:
{{totalamount | currency:GBP}} → £8,340.00
{{totalamount:C}} → £8,340.00 (D365 colon-direct)
{{requestdeliveryby | date:long}} → 09 May 2026
{{requestdeliveryby:dd MMM yyyy}} → 09 May 2026
{{customer.name | upper}} → ACME INDUSTRIALLookups (single hop)
Use the navigation property name + dot + the column on the related entity.
{{customerid_account.name}} → Acme Industrial Pumps
{{ownerid.fullname}} → Lena Hartwell
{{primarycontactid.emailaddress1}} → lena@acme.examplePolymorphic lookups (post-2026-05-08)
Don't know whether the lookup points at an Account or a Contact? Drop the type suffix entirely. Templ8r fans out to both at runtime in a single OData call and uses whichever returns data.
{{customerid.name}} → works for either accounts(...) or contacts(...)Multi-hop chains
Walk further with more dots. Compiles to nested $expand in a single Dataverse fetch — no per-hop billing, no N+1.
{{customer.account.parent.owner.fullname}}
↓ compiles to
$expand=customerid_account($expand=parentaccountid($expand=parentaccountid($expand=ownerid($select=fullname))))Repeating rows (1:N collections)
Put a token referencing the collection's relationship name + dot + child column anywhere in a Word table row. Templ8r clones the row once per related record.
| Description | Qty | Price | Total |
| {{order_details.productname}} | {{order_details.quantity}} | {{order_details.priceperunit | currency:GBP}} | {{order_details.extendedamount | currency:GBP}} |That single template row → as many rows as the order has line items.
Conditional sections
{{#if revisionnumber}}
This is revision {{revisionnumber}} of the original quote.
{{else}}
First version.
{{/if}}Functions
{{sum(order_details.extendedamount) | currency:GBP}}— total a column across rows{{count(order_details)}}— row count{{today | date:long}}— generation timestamp
{{ /}} shape works as well as a single-run typed token.- Type tokens straight into your branded
.docx. - Save. Upload it on /book-demo or via the portal.
- Bind any unmatched ones in the visual mapper. We auto-suggest 80%+ on first try.
- Publish. Done.