In connection with NAV 2016 I want to e-mail customer statement - I can choose to view account statements, PDF, e-mail, Excel and XML in the "Output Options". I choose e-mail but nothing happens, what am I doing wrong for nothing happens.
I want to send customer statement to one customer per. e-mail.
0
Answers
Andwian
Andwian
https://msdn.microsoft.com/en-us/library/dn951539(v=nav.90).aspx
Note this report works fine from object designer, it will have problem only running from report selections.
Write the below code on
Report Output - OnValidate()
ShowPrintRemaining := (SupportedOutputMethod = SupportedOutputMethod::Email);
CASE SupportedOutputMethod OF
SupportedOutputMethod::Print:
ChosenOutputMethod := CustomLayoutReporting.GetPrintOption;
SupportedOutputMethod::Preview:
ChosenOutputMethod := CustomLayoutReporting.GetPreviewOption;
SupportedOutputMethod::PDF:
ChosenOutputMethod := CustomLayoutReporting.GetPDFOption;
SupportedOutputMethod::Email:
ChosenOutputMethod := CustomLayoutReporting.GetEmailOption;
SupportedOutputMethod::Excel:
ChosenOutputMethod := CustomLayoutReporting.GetExcelOption;
SupportedOutputMethod::XML:
ChosenOutputMethod := CustomLayoutReporting.GetXMLOption;
END;
ArcherPoint
You describe that semilar working code can be found in repport 116 -statement. But I believe that the report that doesn't work is 116??!!
My 116 looks like the code you have above my version is 9.00.43987
I don't know why this was made in that way, but when processing the Statements for mailing, NAV runs through the function CU8800.RunReport which (for some unknown reason) in turn runs CU8800.RunReportWithCustomReportSelection with a blanked CustomReportSelection-record parameter. Now in CU8800.RunReportWithCustomReportSelection the statement EmailAddresses := CustomReportSelection."Send To Email"; is called (and for good reason, as you can set different e-mails for different document types), but if no "Document Layout" is setup for the Statement on the Customer, no Custom Report Selection will exist with an email address, and naturally the variable EmailAddresses will be blank. And a Statement for a blank email address obviously won't be mailed. (but it will be printed though if you selected Print Remaining on the request page).
So try setting up the Document Layout for Customer Statement with an email address on the Customer in question - that worked for me.