All document types
Dynamics 365 Salesaccountinvoice

Generate a statement of account from Dynamics 365

A statement of account is a one-to-many document: one customer, many invoices. The account record has the customer; the invoices reference the account through customerid. Everything else is layout.

The account review deck's manifest shows the pattern. Bind the template to account, add a link-entity on invoice from customerid to accountid with a filter for unpaid statuses and an order by due date, then loop over it in a table. {{sum:account.invoices.totalamount:N2}} gives the outstanding total without a rollup column.

Unlimited watermarked use, no time limit. $2,400 a year per tenant removes the watermark.

How it works

From record to statement of account in 3 steps

01

Start from the invoice template

Download it, change the bound table to account, and replace the line-item link-entity with one on invoice (from customerid to accountid, alias invoices) filtered to open statuses.

02

Replace the line-item row

Columns become {{invoicenumber}}, {{_raw.datedelivered:d MMM yyyy}}, {{_raw.duedate:d MMM yyyy}} and {{totalamount}}, opened with {{#each account.invoices}} and closed with {{/each}} on the same row.

03

Run it at month end

Select the accounts in a view (up to 100 a run) and click Generate document; each statement attaches to its account. Or a scheduled flow loops the accounts and calls vdocs_GenerateAndAttach for each, then emails from the note it created.

The template

Start from the invoice starter

Filter in the manifest, not in the template: <condition attribute="statecode" operator="eq" value="0" /> inside the invoice link-entity keeps closed invoices out of the statement.

  • Invoice number, issue date and due date in the header
  • Bill-to address and the originating order number
  • Line items from invoice products with quantity, unit price, tax and amount
  • Subtotal, conditional discount, tax, conditional freight, amount due
  • How-to-pay section with placeholders for your bank details

Tokens in the template

Statement of account · {{account.name}} · {{date:d MMMM yyyy}}

Invoice | Issued | Due | Amount
{{#each account.invoices}}{{invoicenumber}} | {{_raw.createdon:d MMM yyyy}} | {{_raw.duedate:d MMM yyyy}} | {{totalamount}}{{/each}}

{{count:account.invoices}} open invoices · outstanding {{sum:account.invoices.totalamount:N2}}

Paste any of this into the template playground with the sample data to see it render in your browser.

Questions
Can overdue invoices be marked?
Templates do not compare dates, so add a Yes/No calculated column such as isoverdue on invoice and wrap a marker in {{#if isoverdue}}OVERDUE{{/if}} inside the row.
Does the total respect the currency symbol?
The aggregate parses the formatted strings, strips the symbol and thousands separators, and totals the numbers. Format the result with :N2 or :C2 as you prefer, or print {{account._raw.<rollup column>:N2}} if you maintain a rollup.
One statement per account for hundreds of accounts?
Yes. From a view, 100 at a time with each attached to its account; from a scheduled flow, vdocs_TemplateBatch renders a chunk of accounts into one zip or one merged PDF for printing, or a loop of vdocs_GenerateAndAttach puts each on its record.

Rendered in your tenant. Priced per tenant.

VerseDocs is a managed solution of Dataverse plug-ins. Templates, field values and generated files stay in your environment. Try every feature free with a watermark; one licence key removes it for every environment, user and document in the tenant.