Document templates and Word mail merge in Dynamics 365
How to generate Word and Excel documents from Dataverse records — document templates, mail merge, and the customer-facing document workflow.
For customer-facing documents — proposals, contracts, statements, certificates, personalised letters — Dynamics 365 generates Word and Excel files from document templates bound to record data. The mechanism replaces what used to be manual Excel exports and copy-paste, producing consistent, branded documents with one click.
Document templates. A document template is a Word or Excel file with placeholder content controls that bind to Dataverse fields. The user creates a record (an Opportunity, a Quote, an Order, a Customer), clicks Word template or Excel template, picks a template, and the system generates a personalised file with the record's data filled in.
Creating a Word template.
- From the record page, click Word Templates → Create Word Template.
- Choose the source entity (Account, Opportunity, etc.) and related entities to include (Contacts on the Account, Opportunity Products, etc.).
- Download the template skeleton — a
.docxwith the XML schema for the chosen data. - Open in Microsoft Word. The XML Mapping Pane (Developer tab → XML Mapping) shows the available fields from the selected entities.
- Design the document layout — headings, paragraphs, tables, images, branding.
- Drag fields from the XML Mapping Pane to insert content controls. A
{!Name}placeholder for the customer name; a{!Total Amount}for the opportunity value; a repeating section for line items. - Save the template.
- Upload back to Dynamics 365.
The template is now available for that record type. Selecting it generates a personalised document.
Excel templates work similarly — for analytical or spreadsheet-style outputs.
System templates vs personal templates. Templates can be system-wide (available to all users with permission) or personal (visible only to the creator). System templates are governed through solution lifecycle.
Common use cases.
- Sales quote PDF — Word template that renders a branded quote document from an Opportunity's products and prices.
- Statement of work — long-form document with sections personalised to the customer and engagement.
- Welcome letter — personalised onboarding letter to new customers.
- Service report — a Word template summarising completed cases or work orders for the customer.
- Certificates — training completion, compliance certifications, audit attestations.
- Inspection reports — Field Service inspection results rendered as a customer-facing PDF.
Limits.
- Single record at a time typically — Word templates target one record (and its related records), not bulk lists.
- Limited formatting flexibility — Word's content controls don't support arbitrary advanced layouts. Heavy graphic design is awkward.
- Performance on large repeating sections — a template iterating over 10,000 line items will be slow.
- No e-signature integration native — generate the document, then send to DocuSign / Adobe Sign / similar.
Mail merge (legacy). Older Dynamics CRM versions had a mail merge feature explicitly for bulk personalised letters / emails from a list of records. This has been largely deprecated in favour of:
- Customer Insights – Journeys for marketing-grade bulk personalised email.
- Word templates with Power Automate flow for bulk PDF generation (a flow iterates records, generates a document per record, distributes).
The pattern for "generate 500 personalised letters" today: build a flow that loops the records, calls the Word template service, attaches the resulting file to each record, optionally emails.
Power Automate integration. Modern bulk-document patterns use Power Automate:
- Trigger — a button on a view, a scheduled run, or a Dataverse event.
- Action: Populate a Word template — supply a template and the source record data.
- Action: Convert to PDF (optional) — for distribution.
- Action: Send email with attachment or attach to the source record.
This pattern combines Word templates with flow logic to handle the bulk case.
Branding consistency. A useful pattern: build a small library of Word templates for the company — 5–10 templates covering the major customer-facing scenarios — branded consistently. Maintain centrally in a solution; users select from the library rather than rolling their own.
Common pitfalls.
- Template references fields that don't exist — if the schema changes, templates break silently.
- Repeating sections without proper grouping — generate documents missing line items or with duplicated data.
- Heavy templates exceeding limits — very large documents may fail to generate.
Operational reality. Word templates are the unglamorous workhorse of customer document generation. Built well, they save hours per week per sales / service rep.
Related guides
- Dataverse data import templatesHow to bulk-import data into Dataverse using import templates — the wizard, CSV/Excel formats, lookups by name, duplicate detection, and the gotchas of large imports.
- SharePoint document management for Dynamics 365How Dynamics 365 stores documents — the SharePoint integration model, folder structure, permissions, and operational gotchas.
- Account hierarchies in Dynamics 365How Dynamics 365 models corporate parent-subsidiary relationships — account hierarchy field, hierarchy charts, security, and reporting roll-up.
- App designer for model-driven appsHow to build a model-driven Power App — site map, tables, forms, views, business process flows, dashboards, and the app-experience layer.
- Async jobs in DataverseHow Dataverse runs background work — system jobs, async plug-ins, workflow runs, and how to monitor, troubleshoot, and prevent the async backlog from getting out of hand.