Building blocks
In short
A building block is an area that looks the same in selected templates: for example a header with the details of the opportunity, an address block, terms, or a footer with the bank details. You edit it like a small template of its own with its own data source (or with no data at all). You insert it into a template as a building block object and say where its record comes from. Only the reference is saved in the template; if you change the building block, the change takes effect immediately in every template that uses it. On its own, a building block does not create a document.
What a building block is
A building block is a small template whose content is exactly one area. It either needs a record of a certain table, for example an opportunity, or it needs no data and carries only fixed content. Its fields, relationships, rules and variables belong to it alone.
- The template contains only a reference. Which building block, through which connection it gets its record, and which prefix its variables carry. Smart Templates inserts the content only when the document is generated. That is why every change to the building block takes effect immediately in all templates that use it; there are no older versions.
- A building block is not a document. It does not appear in the template picker, in the button assistant or in the flows. If a button or flow points at a building block anyway, nothing is created; the message says “… is a building block and does not create a document on its own.”
- For one record, not for every row. A building block hangs on the main record of the template or on a lookup (N:1), never on a list (1:N) and not in a table cell.
- License: Building blocks are included without a feature of their own; as with templates and documents, nothing is counted (see Prices and licensing options).
A building block is meant for a header, address block, terms, signatures or a footer. Long lists belong in the template itself (see What is different in a building block).
The “Building blocks” window
In the template row at the top, click “Building blocks” (the symbol with the puzzle piece). When it opens, the window reads all building blocks and the templates they are in. The header and buttons of the window stay in place; if the list is long, only the list scrolls.
| Column or button | Meaning |
|---|---|
| “Name” | The name of the building block. A gray addition notes something special: “inactive”, “rule cycle” (red) or “not readable”. |
| “needs” | The table whose record it needs, or “— without data”. |
| “Used in” | How many templates it is in, or “nowhere”. |
| “changed” | When it was last changed. |
| Below the list | The uses of the selected building block: for each template its connection there (column “Connection”), its prefix and the button “Open template”. |
| “+ New” | Creates a building block (see Creating a building block). |
| “Edit” | Opens the selected building block (see Editing a building block). |
| “Insert into this template” | Inserts it into the open template (see Inserting a building block). A building block with a rule cycle and an inactive one are not offered; the mouse pointer gives the reason. |
| “Export” | Saves the selected building block on its own as a file (see Exporting and importing). |
| “Import” | Fetches a building block from such a file. The open template stays open; afterwards the imported building block is selected in the list (see Exporting and importing). |
| “Delete” | Deletes it after a confirmation. Locked as long as it is in a template; the mouse pointer names the templates: “Locked: the building block is still in …. Remove it there first.” If the uses cannot be read at the moment, “Delete” stays locked as well. |
If there is no building block yet, the window says “No building block yet — create the first one with »+ New«.”
Good to know
An inactive building block (set to “Inactive” in Dynamics) is no longer offered for insertion. Where it is already placed, it continues to be inserted; for a building block, inactive therefore does not mean “print empty”.
Creating a building block
- In the “Building blocks” window, click “+ New”. The “New building block” window appears.
- Enter a “Name”, for example “Chancenkopf”.
- Under “Needs”, choose what the building block reads: “Data from a table” (you choose the table in the next step) or “without data” (fixed content only, for example a footer with bank details).
- Enter the size of the “Area”: width × height in millimeters, at least 10 × 5. The defaults are the width of the type area of the open template and a height of 40 mm.
- Click “Create”. The building block is created and opens as a document of its own, with a yellow band at the top (see Editing a building block). With “Data from a table”, the designer asks right away for the primary source, as under “⚙ Manage data sources” (see Data sources and relationships). The area contains a first text with the name of the building block; you can delete it.
The width of the area is the same in every template. The height is the minimum height: The area grows with its content like a group with “Automatic height (fit to content)”.
What is different in a building block
As long as a building block is open, the designer lacks what belongs only to a document: “Manage buttons in Dynamics”, the flows, “Duplicate”, “Blank page”, “Page break”, the buttons for adding and removing pages on the sheet, and “Building block”: A building block inside a building block is not possible. The Template settings have no “E-invoice” tab, no “Keep warm” and no “PDF name”; at the top a yellow note says that the settings there apply only to the preview of the building block.
- The area is the building block. It cannot be deleted, only emptied (“The area belongs to the building block and cannot be deleted — delete the objects in it.”). New objects go into the area. On the area you set only what is the same in every template: size, background, border, corners and spacing. Visibility, position, positioning behavior, keep together and “Repeat on every page” you set on the building block object in the template (see The building block object in the template).
- Inside, the rules of a group apply, in the building block as when inserted (see Groups): Texts, images, codes and shapes stay fixed without a setting of their own, nothing moves along, and a table has no page break of its own. At the end of a page the whole area is split, and only if “Keep together at page break” is off on the building block object.
- Language, number and currency format and font come from the template the building block is in when printing. What you set in the template settings of the building block applies only to its own preview. Fixed settings on a variable of the building block (symbol, decimal places) stay.
Editing a building block
You open a building block in three ways: in the “Building blocks” window with “Edit”, by double-clicking the building block object in a template, or in the object’s properties window with “Edit building block …”.
- The designer asks “Edit building block »…«?” and says where it is placed: “Caution: this building block is embedded in: … Every change takes effect immediately in all of them.” If the open template has unsaved changes, that is mentioned as well.
- Click “Open building block”. The building block appears in the designer as a document of its own. At the top is the yellow band with the building block symbol and “Building block »…« — embedded in: … Changes take effect immediately in all of them.”, plus “← Back to »…«” (the template you came from) and “Building blocks …”.
- Change the content as in a template and save with “Save”.
What is checked when saving
- The designer creates field lists itself. On the primary source, on further sources and on every relationship with a rule, it then records which fields the building block reads. Without a field list, a building block could not be saved.
- Errors block saving with the list of reasons: “The building block cannot be saved like this: …”. This applies above all to a reference that the building block does not have, for example a field that does not exist in its table, or a typo (see What a building block may read).
- If the building block is already in templates, saving asks loudly (“Caution when saving the building block: … Save anyway?”) if its rules depend on each other (rule cycle), if you removed or renamed a variable that a template uses (the template is named), or if it has been given a different primary source. With “Save anyway” it is saved; the designer does not rewrite the templates themselves.
Caution
A removed variable that a template uses in its text stays empty there. If it appears there only in a condition, printing takes the else branch and reports it as a warning (“variable '@…' in a condition: there is no variable with this name …”). That is why the question when saving names every template and place; correct them afterwards in the template.
Inserting a building block
- Open the template and, in the ribbon in the “Containers” section, click “Building block”. Or choose a building block in the “Building blocks” window and click “Insert into this template”. The “Insert building block” window appears. At the bottom left, “Manage building blocks” leads to the “Building blocks” window with the chosen building block preselected; you also create a new one there.
- Under “Building block”, choose the building block. Inactive and unreadable ones are gray and cannot be chosen; a building block with a rule cycle carries the addition “rule cycle” and cannot be inserted.
- Under “Connection”, choose where its record comes from. The sentence above says what it needs, for example “»Chancenkopf« needs: Verkaufschance (opportunity). Choose where it comes from in »Angebot«:”. The button shows the chosen connection with display names, for example “Angebot › Verkaufschance”; if exactly one connection in the loaded part leads to this table, it is already chosen. A building block without data needs no connection; the row is then missing.
A click on the button opens the “Choose connection” window, built like the field picker: at the top the search box, below it a line that says how many connections lead there, and the tree with the lookups (N:1) of the main record, without fields, lists (1:N), rules and variables. It has two parts: at the top, expanded, “Leads directly to »…«”, below it, collapsed, “Via another lookup”.
- Under “Leads directly to »…«” are the main record, if it has this table, and every lookup that points directly to it. You see them right when the window opens, even if the template has hundreds of lookups. If none leads directly there, it says “No lookup leads there directly — expand »Via another lookup« below.”
- “✓ Use this connection” appears on the main record, if it has this table, and on every lookup that leads to it. The one already chosen carries “✓ Selected”. A click takes over the connection and closes the window.
- For a path over several levels, expand “Via another lookup” and there a lookup with ▸, for example Angebot › Verkaufschance › Firma, down to the sixth level. A lookup at the top can be expanded this way as well.
- Relationships are printed down to the sixth level, and what the building block itself reads through its relationships lies below the connection. If both together reach deeper, the row shows in gray “too deep for this building block — its own relationships reach 1 more level” instead of the button; something would stay empty in print there. Then choose a connection closer to the main record.
- The search finds lookups by their display name and by their internal name, in both parts, but only in what is already loaded. What lies behind a lookup that has not been expanded yet it finds only after you have expanded it.
- Expanding, searching and closing (×, Escape or a click outside) change nothing in the template. Afterwards the focus is back on the button under “Connection”.
- Check the “Prefix”. The name of the building block is suggested, with “_” instead of spaces (“Adresse Kunde” becomes “Adresse_Kunde”). Letters, digits and “_” are allowed, but not a digit at the start. The prefix must be unique in the template and must not have the same name as a variable of your own. Next to it is how the variables will then be named: “Variables are then called »@Chancenkopf.Name«”.
- Read the lines below. A red sentence “The area would stay empty like this …” blocks insertion. The last line gives the cost, for example “Queries of this template afterwards: 2 instead of 1 (+1). Joins of the main query: 3 of 10. The table of the connection itself costs no query — it becomes a join.” (see What a building block costs in queries).
- Click “Insert”. The building block object is at the bottom of the document and is selected. Move it to its place. Undo (Ctrl+Z) reverts the insertion in one step.
- If no connection leads there, as far as the template is loaded, a gray line under the button says: “No connection selected yet — open »Choose connection« and expand lookups.” Usually it is just behind a lookup that has not been expanded yet. The sentence is red only if there really is none: “In »…«, no connection that this building block can use leads to the table … — neither the main record nor a lookup (N:1), not even over several steps. Choose a different building block.”
- Field list: When inserting, the chosen lookup gets its field list so that the building block reliably gets its fields. If the fields of the table cannot be loaded at the moment and the template itself reads fields through this lookup, “Insert” stays locked and gives the reason; try again a little later. “Cancel” changes nothing in the template.
- Not possible: in an open building block (“A building block cannot be inserted into another building block (version 1).”), in a new template that is still a draft, and in a template without a primary source.
- The same building block twice in one template is possible, for example one address block for the invoice customer and one for the delivery customer, with two prefixes.
The building block object in the template
On the canvas, the building block object has a purple, dashed frame and, at the top left, the label with the building block symbol, the name and the connection, for example “Chancenkopf · Connection: Verkaufschance (opportunityid)”. Its content appears slightly gray and cannot be clicked: A click always hits the object itself. In the structure it is called, again with the symbol, “Building block »Name«”, without the content below it.
- Move yes, size no. Drag the object to its place. It has no handles: Width, height, background, border and content come from the building block. The height of the area is the minimum height; if the content grows, the object grows with it. An object below it with “Flowing” keeps the drawn distance in the process (see Positioning behavior). The canvas shows the height from the building block, as with every group.
- What you set on the object: the visibility, the position, the positioning behavior, “Keep together at page break” and “🔁 Repeat on every page”. With these, the building block becomes a header or footer, for example for bank details and management in selected templates (see Pages, header and footer).
- The properties window shows, in the “Building block object” box, the building block, its connection (“Connection”), its prefix, its status and its variables, plus “Edit building block …”. Connection and prefix cannot be changed there: To do that, insert the building block again and delete the old object.
- Copy, cut, Ctrl+D: Only the reference is copied. When pasting, the prefix gets a number if it is already taken (“Chancenkopf2”). In another template without a matching record, the object shows the label “Connection missing”.
- Delete the object like any other. The building block itself stays; as soon as the template is saved, it no longer counts among its uses in the “Building blocks” window.
The variables of the building block
Of a building block, the template sees only its variables. In the Data tree and in every field picker they are in a category of their own, “Building block »Chancenkopf«”, with the prefix before the name: “Farbe” becomes “@Chancenkopf.Farbe”. If the same building block is in the template twice or the prefix differs from the name, the prefix is shown in parentheses.
- You use them like a variable of your own: in text as
{{@Chancenkopf.Farbe}}, in conditions as@Chancenkopf.Farbe(see Variables). It has a value in the whole document; it is calculated with the record of the building block. - They can be edited only in the building block itself. A dot in the name exists only for building blocks; the name field of a variable of your own does not accept one.
- If a variable of your own in the template has the same name as the prefix of a building block, the designer warns, and the area of the building block stays empty.
- Fields, relationships and rules of the building block appear nowhere in the template: not in the data tree, not in the field pickers, not under “⚙ Manage data sources”. What a building block brings along belongs to it.
What a building block may read
A building block must work the same in every template. That is why a fixed rule applies: A building block reads only what it has itself and never looks above its connection. A field that is empty or missing on the record of the connection stays empty, even if the template has a field of the same name. An example: The budget of the opportunity is empty, the quote has a budget of €5,000. The building block on the opportunity shows an empty budget, never the €5,000 of the quote.
- Unknown references in the building block, for example a typo or a field that its table does not have, already block saving (see What is checked when saving).
- If a rule of the building block names something it does not have or something that, on the record of the connection, only the template provides (a relationship or a rule result of the template, and for the connection to the main record also a source of the template), the whole area stays empty. The object then shows the label “Rule reads unknown names” or “Rule reads the main template”, and the document is not sent out by email or flow (see When the area stays empty).
- A lookup field is read by the building block through a relationship of its own: In the building block, expand the lookup in the data tree and take the field from there. There is one exception today: If the content of a building block names a field behind a lookup, for example
{{parentaccountid.name}}, without having the relationship itself, then when inserted it shows the value that the template fetches through the same lookup. In a template without this relationship the field stays empty. So create the relationship in the building block. - Conversely, the template reads nothing that only the building block brings along. If the template fetches a lookup only because the building block needs it, and then itself reads a field through it, it cannot be saved: “The template cannot be saved like this: … only works via the building block …”. Create the relationship in the template itself; the building block then shares it.
What a building block costs in queries
The record of the connection costs no query of its own: It becomes a join of the query the template makes anyway. Everything the building block brings along itself counts for the familiar reasons: at most one query per rule, one per further source, a new one when a chain becomes more than four lists (1:N) deep, and a new one at the limit of ten joins. A building block never creates a new reason for a query. Reading the building block itself is not a data query.
- Two lists side by side: If the building block brings a list (1:N) and the template itself has a list in the same query (for example the line items of the quote), one of the two gets a query of its own. Side by side in one query, the rows would otherwise multiply. Which of two lists side by side gets its own query depends on the order of the relationships — the number of queries and the printout do not.
- Ten joins: The lookups (N:1) of the building block count against the ten joins of the shared query. If it gets tight, a lookup gets a query of its own; that can also be one of the template. The insert window gives the number beforehand.
- Depth: Under a lookup the building block slides one level deeper. If a chain then reaches beyond six levels, the part that is too deep stays empty, and the object shows “Depth limit 6”.
The “Insert building block” window gives the number before and after. The whole plan is delivered by the action with Mode=plan, with the building block inserted (see Actions and APIs).
Labels on the building block object
If something is wrong, the object carries a label at the top right. Red means: The area stays empty, or all rules are off. Yellow means: The building block is inserted, but with a finding. The sentence for it is shown by the mouse pointer over the object and by the properties window under “Status”.
| Label | Meaning | What you do |
|---|---|---|
| “⏳ Building block »…« is loading …” | The designer is still fetching the building block. | Wait a moment. |
| “⚠ Building block »…« is missing” | The building block no longer exists, for example because it was deleted in Dynamics. | Delete the object, or create or import the building block again. |
| “⚠ Building block »…« not readable (permissions)” | You are not allowed to read the building block. Documents are still printed completely. | Ask your administrator about the role (see Rights and roles). |
| “⚠ Building block »…« could not be retrieved”, “⚠ Retrieval failed” | The retrieval failed. | Open it again later. |
| “⚠ »…« is not a building block”, “⚠ Building block »…« is damaged”, “⚠ Building block »…« is not readable” | The reference points to an ordinary template, or the building block has no area or cannot be read. | Open and check the building block in the “Building blocks” window, or delete the object and insert it again. |
| “⚠ Connection missing”, “⚠ Connection does not fit” | The record of the connection is missing in the template, or it has a different table. | Insert the building block again and choose the right connection. |
| “⚠ Prefix used twice”, “⚠ Prefix not valid”, “⚠ Prefix = variable name” | The prefix is already taken, spelled incorrectly or has the same name as a variable of your own. | Rename your own variable or insert the building block again with a different prefix. |
| “⚠ Rule reads unknown names”, “⚠ Rule reads the main template” | A rule of the building block names something it does not have (see What a building block may read). | Correct the rule in the building block. |
| “⚠ Rule cycle — ALL rules off” | Rules of the building block depend on each other. Then all rules of the whole document are off, including those of the template. | Correct the rules in the building block. |
| “⚠ No building block inside a building block”, “⚠ not possible in a table”, “⚠ only on a group” | A building block is in a building block or in a table cell, or the reference is on an object that is not a group (for example after a manual change to the file). | For “⚠ No building block inside a building block” and “⚠ not possible in a table”: move the object to an allowed place or insert the building block again. For “⚠ only on a group”: remove the “baustein” entry from the object, for example in the template file; do not delete the object itself. If a building block is to be there, additionally insert it again at that place. Only inserting it again leaves the entry on the object and with it the message, and the document stays incomplete (see When the area stays empty and Problems and messages: Building blocks). |
| “⚠ Name already taken” | A name that the building block brings along already exists in the template. | Insert the building block again with a different prefix. |
| “⚠ could not be inserted safely” | The designer could not make sure that every reference was rewritten correctly; it prefers to leave the area empty. | Check the content of the building block, above all summaries in table cells. |
| “ⓘ unknown references” | Inserted, but a reference in the content does not resolve; it stays empty. | Correct the reference in the building block. |
| “ⓘ inactive” | The building block is inactive. It continues to be inserted but is no longer offered for insertion. | Nothing, or set it active again. |
| “ⓘ Depth limit 6” | Part of the building block is too deep and stays empty. | Bind the building block closer to the main record or shorten the chain in the building block. |
| “ⓘ Note” | Another note on insertion, for example that a relationship now loads all columns. The sentence is shown by the mouse pointer and the properties window. | Depends on the sentence; usually add a field list in the building block. |
When the area stays empty
An empty building block area counts as an error, whatever the reason: The building block is missing, the connection does not fit, a rule reads unknown names, the retrieval failed. The same applies to a rule cycle in the building block, because it switches off all rules of the document. The space of the area then stays empty.
- Email: A button or action that prepares or sends the document by email aborts; no email is created. The message gives the reason: “The document is incomplete because of a building block: … — no email was created.”
- Flow: A flow on the button is not triggered, because it could send the document to a customer. The PDF itself comes through, and the “Smart Templates” window shows the warning “The flow »…« was NOT requested — the document is incomplete because of a building block …”. That is the wording for a flow via the trigger table, as the designer creates it; for a flow with a row trigger on the table of the record, which Smart Templates starts directly, it says “triggered” instead of “requested” (see Actions and APIs).
- E-invoice: No file is created: “The template is incomplete because of a building block: … — no file was created.”
- A button that only shows the PDF delivers it anyway, with the warning in the “Smart Templates” window (see What happens on click). Nothing is sent in the process. This should rarely happen; usually a building block has been deleted or a connection no longer fits.
The messages for these cases are described under Problems and messages.
Exporting and importing
“Export” in the template row takes along the building blocks of a template: Each one that is used appears once, in full, in the file. You export a building block on its own in the “Building blocks” window.
When you “Import”, the designer compares each building block in the file with those in this environment by its identifier. The identifier is assigned when the building block is created and stays the same on export.
- Same content: The existing one is taken silently.
- Missing here: It is created.
- Different content: The “Building blocks from the file” window shows both versions with their dates, and you choose:
- “Take the existing one” (default): The template points to the building block in this environment; nothing is changed. If the existing one lacks something the template needs, for example a variable or the matching table, that is shown below.
- “Overwrite”: The building block here gets the content from the file. This takes effect immediately in every template that uses it; they are listed. If this removes something there, a variable or the matching table, or a rule cycle would arise, that is shown below, and “Apply” asks once more, as when saving a building block.
- “Create as a copy”: a new building block with its own identifier and the addition “(copy)” in the name; only the imported template points to it.
You import a building block on its own most simply in the “Building blocks” window with “Import”: The file is checked as with importing in the template row, then the same choice applies as above (if it is missing here, it is created; if the same, it is taken; if different, the “Building blocks from the file” window asks). The open template stays open; afterwards the “Building blocks” window is shown again, with the building block selected. The window does not accept a template: “»…« is a template, not a building block — templates are opened with »Import« in the template row.” If exactly this building block is open right now and has unsaved changes, “Overwrite” asks beforehand (“Overwriting discards them. Overwrite anyway?”); afterwards it is reloaded with the content of the file.
With every choice, the designer checks the template as it would then stand here; with errors it cannot be applied. After “Apply”, the building blocks are stored and the template opens; you store the template itself, like any import, with “Duplicate” (see Managing templates). A file with a building block on its own opens as a building block after the import.
Building blocks and AI
- AI package: If the template contains building blocks, the section “Building blocks in this template” follows after the template, with name, connection (in the package “binding”, like the key “bindung” in the template JSON), prefix and variables for each building block object. The AI does not get the content of a building block (see Working with an external AI).
- AI changes may only move a building block object, set its visibility or remove it. A change that alters it, fills its content or creates a new one is rejected; so is a new reference of the template to something that only the building block brings along. What was already like that in the template does not stop a change.
- If the AI changes a building block itself, the answer says how many templates it is in, and the designer shows it as a message (see Working with the AI assistant in Copilot).
Building blocks in Dynamics
- Building blocks are in the same table as the templates. The column “Art” distinguishes them; in the lists of templates (Active, Inactive, Quick Find view, Associated view) they do not appear, they are in the view “Bausteine”.
- The same role permissions apply as for templates. Anyone who may not read a building block sees the label “not readable (permissions)” in the designer; it is still printed completely.
- Building blocks are not kept warm separately but together with the templates they are in (see Keep warm).
- Deleting through the view in Dynamics is not locked. The templates that used it then show “Building block »…« is missing”, and their documents are no longer sent out by email or flow. So delete building blocks in the designer: There “Delete” is locked as long as the building block is in use.
What does not exist (yet)
- A building block inside a building block.
- A building block per row of a list (a connection over a 1:N relationship).
- A size of its own per template; width and minimum height always come from the building block.
- Turning an existing group into a building block. Create it with “+ New” and copy the content into it.
- Duplicating a building block. The copy would carry the same identifier; a copy with its own identifier is created on import with “Create as a copy”.
- Inserting directly into a group or by dragging from the window. The building block goes to the bottom of the document; move it afterwards.
What changes in the document?
On the canvas
The building block object shows the content of the building block with the sample data of the template, slightly gray, with a purple dashed frame and the label with the building block symbol, the name and the connection. Frame and label are only aids on the canvas. A label at the top right reports a finding; if the area is empty, it is hatched in red.
In the PDF
At the place of the object is the content of the building block with the record of its connection, in the language, number and currency format and font of the template. If the content grows beyond the height of the area, the area grows with it, and an object below it with “Flowing” moves down. If the area stays empty, its space stays empty, and the document is not sent out by email or flow.