Dynamic Email Fields in Document Handling

Prev Next

What Are Dynamic Email Fields?

Dynamic Email Fields let you insert live data from Business Central directly into your email subject lines and email bodies. When an email is sent, the placeholders are automatically replaced with actual values from the document, customer, vendor, or company record.

For example, instead of writing a generic subject like "Invoice enclosed", you can write:

Invoice {Document.No.} for {Customer.Name}

Which becomes:

Invoice SI-00123 for Contoso Ltd.

Enabling the Feature

Dynamic Email Fields is an opt-in feature. To enable it:

  1. Go to Document Handling SetupDetailed App Feature Setup
  2. Find the feature "Dynamic Email Fields" and toggle it Enabled
  3. Confirm the activation prompt

Note: When activated, all existing Document Handling Templates are automatically migrated to the new enhanced format. Your templates will continue to work as before, and you can disable the feature again if needed.


Placeholder Syntax

All placeholders follow one of these patterns:

Pattern Description
{Document.FieldName} A field from the document header (Sales Header, Invoice, etc.)
{Customer.FieldName} A field from the sell-to Customer record
{Vendor.FieldName} A field from the buy-from Vendor record
{Company.FieldName} A field from the Company Information record
{Line.FieldName} A field from the last document line
{SignatureName} Name from the sender's signature setup
{SignatureTitle} Title from the sender's signature setup
{SignaturePhone} Phone from the sender's signature setup
{SignatureEmail} Email from the sender's signature setup

Important: Field names are case-insensitive and must match the AL field name in Business Central (e.g. No., Name, Amount, Due Date).


Supported Document Types

Dynamic fields are resolved for the following document types:

Sales

  • Sales Quote, Order, Invoice, Credit Memo, Blanket Order
  • Posted Sales Invoice, Shipment, Credit Memo
  • Customer Statement

Purchase

  • Purchase Quote, Order, Invoice, Credit Memo, Blanket Order
  • Posted Purchase Invoice, Credit Memo

Finance

  • Issued Reminder
  • Issued Finance Charge Memo

Using Fields in the Email Subject

Subject-line placeholders are set up in your Document Handling Text Setup. Common built-in subject tags include:

Tag Description
{DocumentNo} The document number
{ExternalDocumentNo} The customer's/vendor's own order number
{LineNo} The document line number
{Customer.No.} Customer number (statements)
{Customer.Name} Customer name (statements)
{StartDate}...{EndDate} Statement period (statements)

Example subject:

Invoice {DocumentNo} - {Customer.Name} ({Document.Your Reference})

Using Fields in the Email Body

In the email body (HTML editor), you can use any field from the supported tables. The field name must match the Business Central table field name exactly.

Single-value examples

Dear {Customer.Name},<br>
<br>
Please find enclosed invoice {Document.No.} dated {Document.Posting Date}.<br>
The total amount due is {Document.Amount Including VAT} with a due date of {Document.Due Date}.<br>
<br>
Your reference: {Document.Your Reference}<br>
Our reference: {Document.Salesperson Code}<br>
Dear {Customer.Contact},<br>
<br>
We are writing regarding reminder {Document.No.}.<br>
Your outstanding balance is {Document.Remaining Amount}.<br>

Company Information fields

If you have questions, please contact {Company.Name} at {Company.E-Mail} or {Company.Phone No.}.

Repeating Lines (Line Repeater)

You can iterate over all document lines to list items in the email body. The syntax is:

[Line:{FieldName1} - {FieldName2} - {FieldName3}]

This outputs one row per document line, separated by a line break.

Example — listing invoice lines:

You have ordered the following items:<br>
[Line:{Line.No.} {Line.Description} Qty: {Line.Quantity} Price: {Line.Unit Price}]

Filtering lines

You can also filter which lines are included using a view filter:

[Line{WHERE(Type=FILTER(Item))}:{Line.No.} {Line.Description}]

This only repeats lines where Type = Item.


Signature Fields

Signature placeholders pull from the sender's Document Handling user setup:

Placeholder Replaced with
{SignatureName} Sender's full name
{SignatureTitle} Sender's job title
{SignaturePhone} Sender's phone number
{SignatureEmail} Sender's email address

These are configured in Document Handling Text Setup under the Signature section (Enable Current User or Get Name from Setup).

Example signature block:

Kind regards,<br>
{SignatureName}<br>
{SignatureTitle}<br>
{SignaturePhone} | {SignatureEmail}<br>
{Company.Name}<br>

Complete Email Body Example (Sales Invoice)

Dear {Customer.Contact},<br>
<br>
Thank you for your business. Please find enclosed invoice {Document.No.} dated {Document.Posting Date}.<br>
<br>
<b>Invoice details:</b><br>
[Line:{Line.No.} | {Line.Description} | Qty: {Line.Quantity} | Unit Price: {Line.Unit Price}]
<br>
<b>Total excl. VAT:</b> {Document.Amount}<br>
<b>VAT amount:</b> {Document.Amount Including VAT}<br>
<b>Due date:</b> {Document.Due Date}<br>
<br>
Your reference: {Document.Your Reference}<br>
<br>
Kind regards,<br>
{SignatureName}<br>
{SignatureTitle}<br>
{SignaturePhone}<br>
{SignatureEmail}<br>
{Company.Name}<br>

Tips

  • Field names are looked up dynamically against the actual BC table, so any field on the table works — not just the ones listed here. Look up field names in the BC table documentation or AL source.
  • If a placeholder is not recognized or the field does not exist, it is left as-is in the email (no error is thrown).
  • FlowFields (calculated fields like Balance) are automatically calculated before substitution.
  • The same template can be used for multiple document types — fields that do not apply to the current document type are simply left blank.