Docentric Emailing Multiple Invoices

By using this free solution, you will be able to send multiple customer invoices in a single email. You can include Sales and Free text invoices, Project invoices or both. You can also choose to send only Open invoices.
Invoices for emailing can be selected by Invoice date or Invoice due date, or by Billing period. Such emails can also be sent via Email distributor batch with zipped or merged invoices.
To design the outgoing emails, you will use Email templates and Email tokens such as Primary customer email or Customer purposes for the email recipients.
The emailing operations is monitored and can be repeated if needed.

The first version of this solution for sending multiple customer invoices in a single email, which are selected by Billing period, was based on the RunBaseBatch framework. It collects invoice documents from Azure Blob storage, stored there during posting & printing via Docentric File print destination with the Save to Azure Blob storage option turned on. The collected invoices are then sent to the customer via single outgoing email based on the selected Organization email templateSee the related article >>

Wishing to achieve greater flexibility, we extended the solution to enable emailing multiple invoices selected also by Invoice date. This solution was based on the SysOperation framework, allowing also Email distributor batch to be used for emailing. See the related article >>

Finally, we consolidated both solutions to be based on the SysOperation framework and to include Project invoices as well. Furthermore, we added new criteria to select which invoices to be emailed, e.g. by Invoice due date or to include only Open invoices. We introduced additional emailing options such as using Email distributor batch and zipping or merging selected invoices.

We called this solution Docentric Emailing Multiple Invoices – DEMI Version 3.1.1 and it is described in this article.

You can download DEMI Version 3.1.1 below. Please note that we do not provide download of the previous versions.


  • Installed Docentric AX Free EditionDownload >>
  • Installed the model for DEMI Version 3.1.1. Download >>
  • Invoice documents stored in Azure Blob storage. This can be achieved during posting & printing by using Docentric File print destination with the Save to Azure Blob storage option turned on. If you didn’t store an invoice document to Azure storage during posting, you can always reprint the already posted invoice from the journal using the appropriate Print management settingsLearn more >>


As said in Prerequisites, in order to be able to send multiple customer invoices in a single email, the invoice documents should be stored on Azure Blob storage and their location information written in the corresponding journal records.

Storing the invoice documents and the location information is the first part of the Docentric Emailing Multiple Invoices (DEMI) functionality and it is achieved during printing invoices in the combination with the Docentric File print destination > Save to Azure Blob storage option turned on.

Once the invoice documents are stored on the Azure storage, you can select them using different criteria, email them more than once and have the information about successful or failed emailing operation.

DEMI features:

Invoice selection by billing period

You can select which invoices should be emailed for each of the selected customers either via billing period or invoice date/due date. This is the only difference between dialogs open via two menu items on the journal forms: Email by billing period and Email by date.


Billing period consists of Billing year and Billing month, and they are automatically calculated from Invoice date and saved to each invoice journal record during printing of the invoice document to the Azure Blob storage.

Invoice selection by invoice date or due date

Alternatively, you can email multiple invoices by date, where you can choose between Invoice date and Invoice due date and afterwards select the wanted date range.


Use relative date range for invoice date or due date

From the version 3.1.1 onwards it is also possible to use a relative date range for Invoice date or Invoice due date, by utilizing the built-in setup General ledger > Ledger setup > Date intervals.

This can be accomplished by configuring a date interval in Date intervals first, for example a date interval for Last month.

Next, we need to choose a wanted date interval on the DEMI job dialog, for example this one we've just created for Last month.

By using relative date ranges, we can now use DEMI in scheduled batch jobs, for example to send the previous months invoices at the start of every month.

Additional invoice selection criteria

Next, you can choose whether to include in the outgoing emails only Sales and Free text invoices, Project invoices or both. You can include only Open invoices (which are not paid) or all, and you can also configure to send only those invoices that haven’t been sent yet.

Customer selection criteria

Emailing operation is applied for all selected customers via a dynamic query. Still, you can select whether to match the customer account number with the Invoice or Customer (Order) account number field on the processing journal records.

Customer email recipients

Email recipients can be configured via Purposes, static email addresses or as a customer primary email contact.

Emailing options

You can choose whether to send emails with or without using Email processing and the Batch email sending status table. Additionally, the resulting invoices for a processing customer can be zipped, merged or attached as separate files to the outgoing email.

Using email templates

For the email body and subject of the outgoing emails, you need to select an Organization email template. These email templates should be bound to the DocEmailInvoicesTemplateHandler_DEMI ETH class (DEMI handler class) in order to have the basic set of placeholders such as Billing period, Customer account number, etc. at your disposal. You can always create your own ETH (Email Template Handler) class to introduce additional placeholders or even dynamic tables in the email body. Learn more >>

If you don’t need placeholders but only static text, then you can use any of the available email templates.

Emailing operation

Emailing operation can be performed ad-hoc or in batch. For each of the selected customers, emailing operation first locates invoice journal records to be processed and locks them by setting the In processing (Locked) field to Yes and Processor ID to a non-empty guid. After the emailing operation completes – no matter if all outgoing emails are sent successfully or some of them failed to be sent - the processing is done, and the journal records get unlocked.


In very rare cases, when an error is not gracefully handled, the records might stay locked. In order to unlock them, you need to use the Admin cleanup button.

Locking processing journal records enables a multiple batch processing capability, i.e. it enables having multiple batch jobs running without interfering with each other.

Download functionality

You can either download all selected invoices as a separate file each, merge them into a single PDF document or have them zipped and downloaded as a single ZIP archive.

Emailing from journals

Emailing multiple invoices can be invoked from the following forms:

  • Invoice journal,
  • Project invoices,
  • Open customer invoices.


Emailing from modules

Emailing multiple invoices can be invoked from the following modules:

  • Accounts receivable > Periodic tasks > Email multiple invoices,
  • Project management and accounting > Periodic > Email multiple invoices.

Resources for DEMI Version 3.1.1

- - 
DEMI version: 3.1.1
Released: February 23, 2024
Bug fixes: Now DEMI can be used with the ProjInvoiceJournalV2 form, which replaces the standard "Project management and accounting > Project invoices > Project invoices" form when the feature "Use Project invoice proposal and invoice journal forms with the Header and Lines view" is enabled.

DEMI version: 3.1.0
Released: January 9, 2023
New Feature: Date ranges can now be chosen dynamically for 'Invoice date' and 'Invoice due date', by using built-in Date intervals.

DEMI version: 3.0.3
Released: July 20, 2022
Bug fixes: Selecting which invoices to be emailed using date range for 'Invoice due date' didn't work properly.

DEMI version: 3.0.2
Released: December 15, 2021
Bug fixes: Improved messaging. Emailing datetime stored on journal records is changed to not contain any time zone.

DEMI version: 3.0.1
Released: November 25, 2021
Bug fixes: Journal records didn't get unlocked after completing the email sending process, when emailing only unsent invoices.

10 thoughts on “Docentric Emailing Multiple Invoices

  1. Hi

    Azure blob storage setting requires full license. so this feature cannot be considered in Free-Edition.

    1. Hi Syed,

      Azure Blob storage setting requires the full license ONLY in case of using some external Azure Blob storage instead of the default one. In the combination with this feature, Emailing Multiple Invoices, the default Azure Blob storage is sufficient and it can be used with our Free-Edition. As a conclusion, this feature is Free-Edition.

      Kind regards,

    1. Hi Lisa,

      Thank you for your question. DEMI is, at least at the moment, considered as a custom solution built on top of our product. We will be ensuring the compatibility with any new Dynamics 365 FO update, and also fixing any bugs. But for now, we don’t plan to include this solution as part of our core product.

      Best regards,

  2. Hello – I have a question on the email by ‘invoice due date’.

    Can the due date parameter be used dynamically in a batch process?  In other words, can I run the ’email by invoice due date’ in batch while setting the invoice due date fields to be ‘due today’ (t) or ‘due yesterday’ (t-1)?

    1. Hi Mike,

      You can use Query range utility methods (otherwise placed in the class SysQueryRangeUtil) such as lessThanDate(int relativeDays = 0) and greaterThanDate(int relativeDays = 0) in the Records to include filter on the Email multiple invoices by date dialog for the CustInvoiceJour table and the Due date field. The CustInvoiceJour table needs to be previously added as a joint data source. Also, you need to leave From date and To date empty for Invoice due date in Parameters > Select date.

      Limitation of this approach is that you cannot combine Free text invoices and Sales invoices posted in CustInvoiceJour with Project invoices posted and stored in the ProjInvoiceJour table.

      In a future version of DEMI, we might add additional parameters for dynamic date selection, similar to lessThanDate() and greaterThanDate() which apply ranges to the current date. It seems like a good idea, thank you for the feedback! We really appreciate it 😊.

      Kind regards,

  3. I will look forward to the enhancement to be made for SysQueryRangeUtil functions applied to the ‘from and to date’.  I particularly like the (Date(-30)) function and it would be VERY useful to use in this feature on a recurring batch job.

    Unfortunately, adding the CustInvoiceJour or ProjInvoiceJour table to the filter criteria does not really work as that filter gets you the base entity ‘customer’.  Then, the UI criteria are added for the secondary entity ‘invoice’. Thus, if I leave the From/To dates blank and use the DueDate in the filter, I will get the correct customer but I will also get ALL the invoices for the customer.

    So far it looks like a great add-on!

    1. Hi Mike,

      Thank you so much for the contribution – for finding bugs and suggesting how to improve DEMI! It’s greatly appreciated!

      Yes, you are right, filtering the way I described previously won’t work 🙁. And because we understand that this is essential in order to schedule a recurrent batch job, we will add additional parameters for relative date ranges in addition to fixed date ranges. We will do this in the near future (in next months). Please stay tuned and thank you for this idea 😊

      Kind regards,

  4. One suggestion would be in the DocEmailInvoicesDistributor_DEMI.buildQueryToMarkRecordsForProcessing method, to have the conditional range for onlyOpenInvoices to include credits.  Currently only looking for a value > 0.  Credits are excluded from that.  Either that, or an additional contrat parameters that signifies if credits should be included.

    1. Hello Joe,

      Thank you very much for your suggestion, we will put it on our TODO list for DEMI.

      Please be aware that since DEMI is just a free add-on and not a part of the core Docentric product, we do not have a release schedule planned for it. In the meantime we encourage you to modify the code to suit your needs!

Leave a Reply

Your email address will not be published. Required fields are marked *


Docentric respects your privacy. Learn how your comment data is processed >>

Docentric respects your privacy. Learn how your comment data is processed >>