[Event Request] Add handled pattern + result to OnBeforeSendEmail (DocumentMailing.Codeunit.al)
Referring #4349
Currently we have done our modifications in the OnBeforeSendEmail event, but we are missing some parameters.
Because we send the mail in the OnBeforeSendEmail event, we need a way to cancel the default send. Would it be possible to add the handled pattern for this?
To keep the function working like before a ReturnValue parameter should be added as well (like in the OnBeforeRunMailDialog event in MailManagement.Codeunit.al).
Is this that you need? Please confirm
IsHandled := false;
OnBeforeSendEmail(TempEmailItem, IsFromPostedDoc, PostedDocNo, HideDialog, ReportUsage, EmailSentSuccesfully, IsHandled);
if IsHandled then
exit(EmailSentSuccesfully);
if OfficeMgt.AttachAvailable then
OfficeMgt.AttachDocument(AttachmentFilePath, AttachmentFileName, GetBodyText, Subject)
else begin
EmailSentSuccesfully := Send(HideDialog);
if EmailSentSuccesfully then
OnAfterEmailSentSuccesfully(TempEmailItem, PostedDocNo, ReportUsage);
exit(EmailSentSuccesfully);
end;
end;
Yes, that is the adjustment we need for our modifications to the document mailing.
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. We will update this issue with information about availability.
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. We will update this issue with information about availability.