Показать сообщение отдельно
Старый 21.08.2017, 07:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,497 / 847 (79) +++++++
Регистрация: 28.10.2006
saurav-nav: Microsoft Dynamics NAV 2017 - Email From NAV Part 3.
Источник: http://saurav-nav.blogspot.com/2017/...l-from_21.html
==============

Hi Readers,

Let's continue what we are discussing from Last two weeks.

To understand the content of this article and use the pattern we are about to discuss in this article you need to go through old articles.

If you haven't read the Part 1 and Part 2 below are the links for same.

Part 1 - Send Email from Navision using a Pattern provided by Microsoft in New version.

Part 2 - Develop a Word Layout for Sales Shipment Report.

In this last article, we will discuss how to use the Pattern & Word Layout for sending an Email.

The idea is Simple - Using word Layout for the Email Body and then use Email Pattern to send Email.

Without Further Delay, let's discuss how we can configure & customize same in NAV 2017.
Thanks to Mohamed Zayed and hope this solves your issue.

** What we are customizing is already part of standard NAV. The article is just for an explanation how to customize if required to be added in some other NAV areas.


1. As we discussed in Part 2 we can have multiple word layout for the same report. These Layouts can be used for other usages than sending the email. So somewhere we need to setup which of the multiple layouts should be used for Emailing from NAV.


Microsoft Have added word layout selection in Report Selections. As shown below I will select the word layout that we created in Last Post.




2. Now Let's add some code for the new pattern that we want to use. New Function Name is SendSalesShipment which accept the record and returns Email is Sent or Not.


Functions Do Pre-Check, we can add more if required. After that, it uses the same Pattern as in Article 1.
While using pattern we use three Functions, shown below -
a. Get Report ID and Word Layout Code to be used.
b. Generate Email Attachment as PDF.
c. Generate Email Body.


After Doing all this, Function sends an email and return if the email is sent.




3. So What these functions Do?


a. GetReportIDandLayoutCode -
This Function looks up of Report Selection table for the Shipment Report and get the report id and also the Layout code.


b. GenerateDocumentEmailAttachment -
This function creates a new pdf file, and use SAVEASPDF using the Report ID from the first function and then exit the File Path for attachment.


c. GenerateShipmentEmailBody -
This function creates a new temp HTML file. select the word layout and use SAVEASHTML to save word layout file. The word layout file path is sent back to the pattern function which is used to pass to the Body File Path.




4. Add a function in Sales Shipment Page for Sending Email.




5. Here is the Email that is sent from NAV.






Hope it helps.


Let me know if it makes sense there are so many additional features in this pattern that I would like to explain if this article helps my readers.


Waiting for your reply.


You can download the codeunit from OneDrive.

File Name- Microsoft Dynamics NAV 2017 - #SauravNAV_Email_Pattern_V2.0


Let me know your views.


Regards,
Saurav Dhyani
saurav-nav.blogspot.in



Источник: http://saurav-nav.blogspot.com/2017/...l-from_21.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.