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 template. See 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 and it is described in this article.
You can download DEMI Version 3.1 below. Please note that we do not provide download of the previous versions.
- Installed Docentric AX Free Edition. Download >>
- Installed the model for DEMI Version 3.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 settings. Learn 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.
- Invoice selection by billing period
- Invoice selection by invoice date or due date
- Use relative date range for invoice date or due date
- Additional invoice selection criteria
- Customer selection criteria
- Customer email recipients
- Emailing options
- Using email templates
- Emailing operation
- Download functionality
- Emailing from journals
- Emailing from modules
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.0 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.
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 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.
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
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.
8 thoughts on “Docentric Emailing Multiple Invoices”
Azure blob storage setting requires full license. so this feature cannot be considered in Free-Edition.
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.
Will DEMI form part of the overall fully licensed solution and therefore be part of standard updates?
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.
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)?
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 😊.
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!
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 😊