Report selection

Use the search function to open the desired report selection - e.g. the one for sales. Now select the desired report. For our example, we will use Invoices, but basically reports are supported from the areas:

  • Sales
  • Purchasing
  • Service
  • Reminder
  • stock on hand
  • Production order
  • Bank account

In the report selection you will find the “File name “ field, which indicates how many individual formulations have already been created. Clicking the field takes you to the File name editing page.
Here you can now define an individual subject for each language code. On the one hand, there is the option here to formulate a static subject that will be inserted in all messages in the same way.

On the other hand, it is possible to design the subject dynamically. By using placeholders, it then adapts to the content of the message.

You can define the placeholders by clicking the […] button on the right margin in the Subject text field. This will take you to the Filename Placeholders page where you can make the definitions.

Define placeholder

On the “File name placeholder “ page there are two fields available:

Placeholder - Here you define how your placeholder should look like.
Definition - This field defines which field your previously entered placeholder refers to.

Creating a new placeholder
First, enter the desired placeholder in the Placeholder field. We recommend using placeholders here that could not accidentally appear in the subject, for example, if you define the placeholder Rech for the invoice number and the subject contains the word Invoice, the Rech part of the word would be replaced in the subject. It is best to use a combination of special characters and numbers or adjust placeholders so that they do not accidentally appear in words.

Now you have to define the field to which the placeholder refers. To do this, click on the Assist button of the Definition field.
Now another window opens, in which all fields from the company data, as well as all fields from the header data of the underlying report are available to you. You can select a field assignment for each placeholder.

To determine the table for the header data, the report metadata of the respective report is examined for its property: FirstDataItemTableID. The standard reports in Business Central store the underlying header for this respective first element (FirstDataItemTableId). Example: Report 1306 -> Sales Invoice Header.
If customized reports have a different structure, i.e. a different table is in the first place, this will also be
this will also be taken over into the table filter, whereby possibly useless fields will be displayed, or important fields could be missed.
For such cases there is the possibility to set the correct target table via an event subscriber depending on the report id.
More about this can be found at Events.

Repeat this process for all the fields/placeholders you want to use in your subject.

Example of a file name with placeholders

Now that you have defined your placeholders, you can add them to file names as you wish. Close the placeholder setup and click again in the “Filename “ field. For our example, we have defined the following placeholders for an invoice.

  • %1 - the invoice number
  • %2 - The recipient name
  • %3 - The due date

With this we could now build for example, this file name: Our Invoice %1 for %2 - Due: %3
How the subject then looks in use, you will learn in the next step.