ForNAV email body layouts

This article is relevant for ForNAV 6.2 and later versions, and Business Central 14 and later versions.

The ForNAV Customizable Report Pack now comes with a set of email body layouts.

 

If you do not select an email body layout when you select a report (or it is a new installation), the default email body layout is set.

 

All the email body layouts are built from the email body template report, which can easily be modified to create the same email experience across all document reports.

The template uses the following two JavaScript functions.

 

GetSalutation

The GetSalutation function uses the standard salutation table in Business Central, which is referenced by the Salutation
Code
in the Contact table

For Invoices and Credit Memos, ForNAV uses Bill-to contact and for other document reports Sell-to contact is used. For non-document reports, the first field with a reference to the Contact table is used.

 

ExpressionFormat

The ExpressionFormat function takes a string with the following format:

Please find <<CurrReport.Caption>> <<Header.No>> attached to this email.

Where JavaScript or field values are embedded in a string prefixed with “<<” and postfixed with “>>”.

The rest of the parameters are there to make sure that the fields referenced in the format string are available in the dataset produced by the report.

The default is to use the caption for the Email Body field on the ForNAV Setup table, which is automatically translated to the language on the document. To change the caption, the ForNAV language functionality can be used: https://www.fornav.com/knowledge-base/translation/.

 

The default output will look like this:

 

However, it is easy to change the output by modifying the template where the field caption ForNavSetup.FieldCaptions.EmailEnd can also be used to get the word “Regards” in the local language.

 

ForNavSetup.FieldCaptions.EmailBody

To produce the value of the e-mail body text, a call to CurrReport.ExpressionFormat(ForNAVSetup.FieldCaptions.EmailBody,Header.No) is used.

The default value for ForNavSetup.FieldCaptions.EmailBody is: “Please find <<CurrReport.Caption>> <<Header.No>> attached to this email.

However, you can easily translate or change this into other languages by adding a line to the ForNAV Language table:

You can use fields or JavaScript by prefixing the source expression with “<<” and postfixing with “>>”. The fields used in the source expressions must be references in the layout for the values to be picked up in the dataset. The easiest way to do this is to add them as parameters to the CurrReport.ExpressionFormat function call.

 

It is also easy to add detail to the email body by changing Show Output from false to true on the data items on the email body layouts, so it looks more like the standard report.

 

 

#e-mail