The basic idea
In short
A template defines once what a document looks like: what goes where on the sheet and which data from Dynamics 365 belongs in it. For each record, such as each quote, Smart Templates fills the template with the matching values and turns it into a PDF.
If you already know this from another template tool, you can skip this page and start right away with Your first template.
One template for many documents
A quote to Contoso Handels GmbH looks exactly like one to Fabrikam AG. Only the content differs: name and address, the line items, the totals. The template describes what stays the same. The data from Dynamics supplies what changes.
- A template belongs to a table in Dynamics, for example to “Quote” or “Invoice”. In the designer, this table is called the template’s primary source.
- Printing is always for one specific record of this table, that is, for one specific quote or one specific invoice.
- A template applies to all records of this table. If you change the template, all future documents look different.
What is on the sheet
The template is a sheet, usually in DIN A4 format. You place objects on it:
| Object | What it is for |
|---|---|
| “Text” | Fixed words such as “Quote” and fields from Dynamics, for example the quote number. |
| “Image” | Your logo or an image from a record, for example a product photo. |
| “Shapes” | Lines, rectangles and other shapes, for example a divider line below the letterhead. |
| “Group” | A container for things that belong together, for example an address block or a totals block. |
| “Data table” | A list from Dynamics, row by row, for example the line items of a quote. |
| “Free-form table” | A table whose rows and cells you fill yourself, for example a header block with address and document data or signature fields. It does not fetch rows from Dynamics; individual fields can, however, appear in its cells. |
In a text, besides fixed words, fields from Dynamics can also appear, for example the customer’s name. Such a field is called a placeholder: it holds the place for a value in the text. On the canvas it appears as a blue marker with the name of the field. In the PDF, the value of the record being printed appears there.
- 1On the canvas, each field is represented by a blue marker with the name of the field.
- 2In the PDF, the value from the record appears in the same place.
What all objects have in common, such as position and size, positioning behavior, border and background, or visibility, is described once each in the group Properties of all objects.
Where the data comes from
On the left in the designer is the “Data” area. There you find everything the template can read from Dynamics:
- The primary source with its fields, for a quote for example number, date and total amount. It is marked with a star.
- Relationships lead on to connected records: from the quote to the customer, from the customer to their contact person, from the quote to its line items. This goes up to six steps deep.
- Rules determine which rows of a list appear on the document and in what order. For example, only line items with a quantity above zero, sorted by line number. A rule can also summarize, for example the total per tax rate.
- Custom variables are values that you set yourself or have calculated, for example a salutation that depends on the customer’s country.
- System variables supply information such as today’s date, the user who is printing, and the page numbers.
More on this under Data sources and relationships, Rules and Variables; how to build a condition is described under Conditions.
Good to know
The template does not store any values from your data. It only describes which fields it needs and fetches the values from Dynamics only when printing. Only the ID and name of the sample record are stored in the template, including in an exported file.
The designer at a glance
You open the designer in Dynamics in the “Smart Templates” app: on the left in the navigation, click “Designer”. Which template opens in the process, and how reloading and bookmarks open the same one again, is described under Managing templates: Which template opens. You choose a different one in the “Template” field in the template row.
How the areas of the designer look and what each contains is shown in The designer at a glance. The buttons of the three bars at the top are described in The header bar, Managing templates and The ribbon. The messages and confirmation prompts are described under Problems and messages, the keys under Keyboard shortcuts.
What the canvas shows
In the middle of the designer you see the sheet with the same font and the same dimensions as in print. Fields from Dynamics appear on it as blue markers with their name, for example “Name” or “Total amount”; only images from a data field are already shown on the canvas with the image of the sample record. What only the real data brings about is not shown by the canvas: a data table appears there with one sample row, flowing objects stand at their drawn position, visibility rules have no effect, and an area that runs over the page edge in print is hatched in orange at the edge. All differences between the canvas and the PDF are described under Full preview and PDF.
How the document really looks with the real values, for example whether a long company name still fits in the line, you see at the top with “Full preview” or “PDF”, even with unsaved changes; what still differs from printing in Dynamics is described under Full preview and PDF: Full preview and printing in Dynamics.
How the template becomes a document
The document is generated in Dynamics, not in the designer. To do this, you set up a button on the table, for example on the quote, using “Manage buttons in Dynamics”. A click on it builds the document for the open record and shows it in a new tab. From there you save or print it. Nothing is stored in Dynamics in the process.
A button can also put the document straight into an email that you see once more before sending, or send it by email without asking. Sending immediately does not work with every template, because the email goes to the printed record itself; which templates this applies to is described under Buttons: the assistant: What should the button do?. How a button is created and how a flow in Power Automate generates documents is described under Buttons: the assistant and Flows.
Tip
Start with an existing template that resembles your document, and change it. “Duplicate” creates a copy that you can work on safely.