Substituting reports causes an error when sending e-mails
There are 3 invoice documents. A standard document (Report 1306 - Word), a B2B document (Report 50016 - RDLC) and a B2C document (Report 50010 - RDLC). The appropriate report is controlled via the "Substituting Reports" feature.
If you want to send a posted invoice by email, an error occurs, because the reports 50016 and 50010 do not match the report 1306 and do not have a custom layout (Word). According to the report selection, one layout of report 1306 is used for the email body and one for the PDF document.
The event "OnAfterSubstituteReport" from the "ReportManagement" does not carry any information about the purpose to differentiate between Email Body and PDF document.
@LutzRose What exactly is the error you experience? Can you provide us with your report selection settings and the customizations you have made?
Hi @LutzRose, I reached out to the team who is responsible for that and here is their response.
They should use the standard application logic for Report selection and drop the substitute report. It’s hard to see form the description why they get a 1306 layout that should run with a 50016 report, but it could be that they have a report layout selection in app code that tell the system to use a particular named report for 1306 even if they substitute for 50016.
For Email bodies, you must use a Word layout as this is inserted as HTML code which we cannot generate from an RDLC report (not supported by local rendering)
I'll close the bug with that, however if that isn't sufficient as to what your issue is, please reopen the issue and let us know.
@darjoo :
Customers are classified differently. There is a separate invoice document for each customer group. Currently there are the groups: Standard, B2B, B2C and for each group a corresponding invoice document. For B2B and B2C new documents were created in RDLC format and for Standard the existing document was taken and a new Word layout was stored.
The standard document is stored in the report selection. This document is configured for document printing and e-mail body output.
If a new document is created, the correct document is taken depending on the customer group. This takes place with the Substitute Report feature.
If a document is sent by e-mail, then the process terminates with an error, because only the standard is configured as e-mail. The error has its origin in the Substitute Report feature, because the e-mail body should also be replaced.
Since you cannot see in the Substitute Report feature whether it is a document or e-mail body output, you cannot react to it.