Another area that needs to be set for the functionality to work properly is the Email Templates table. Templates are used to build a message format that will be automatically generated after the documents are posted – you can enter the message, subject of the message and, if Body is used in HTML, map the variables to the fields from Business Central.
To create a new template, press the New button:
The following window will be displayed:
It is worth setting the Code and Description fields so that it will be easy to assign an Email Template to a Document Template later (e.g. using identical values for the Code, Description or Code and Description fields).
The Subject Pattern field is used to enter the formula generating the message subject. You can set them up in any way, also using formulas used in the BC system (e.g.% 1).
Another important field to be completed is Table No. and Table Name:
- Table No. – for documents that are to be sent by e-mail, it is best to select tables with headers of individual document types (headers of sales invoice, corrective invoices, etc.). This will allow for the correct retrieval of values from the system – document numbers, and other data,
- Table Name will be completed automatically after selecting a value in Table No.
In HTML Body, enter the content of the Email message that will be generated after posting. The use of variables (when creating Body in HTML) can be used in the next step to map and insert values from the system in messages, e.g. it is possible to map the Remaining Amount field in the message body, which allows the customer to see what total amount still has to pay for a given invoice.
Finally, in FastTab Lines, you can map Mail Body variables to fields with BC.
- In the field no. 2 a variable from HTML should be entered, e.g. [POSTINGDATEMY],
- In field no. 1 assign a value from the system, e.g. Posting Date. Additionally, it will be necessary to select a Data Type from: Text, Date, Decimal, DateTime (in the case of Posting Date – Date).