Dynamics NAV E-mail classic reports as PDF

Full article at my blog: mibuso.com/…/

If your customer is running a classic Dynamics NAV installation and wants to add some mail functionality, for example mail purchase order to vendor. In this example I will create a mail functionality and also include a working Codeunit for you to use. The report is report ID 405, and the table is Purchase Header.

Mail report

This example requires Bullzip PDFCreator (http://www.bullzip.com) on every clients who will create mails.

Create a Codeunit with 2 functions.

1. CreatePDF405(Code[30] No) Return Text[250] - This function will create the pdf and return the filename of the created pdf

**2. MailReport405(Code[30] No Text[250] ToMailAddress)**Return Text[250] - This function will create a mail if the pdf is created.


How to use the function, open Purchase form and add a button.


Add code to the form (not included in the example code)


At the button function push, add 2 variables, one for the codeunit and one for vendor table.
Look up the e-mail address for the vendor and call the function with purchase order number and email address

That’s all, you can easy create more functions to mail other reports. It may exists easier ways of solve this problem but I think this is good enough. :-)

What will happen if file attachment is big size??

Don’t think it would be any problem, i have now tested it with a 14 mb large file.

But the mail server may have limits of mail sizes.