ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Add handled pattern + result to OnBeforeSendEmail (DocumentMailing.Codeunit.al)

Open wdet opened this issue 6 years ago • 4 comments

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).

wdet avatar Jan 24 '20 09:01 wdet

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;

AlexanderYakunin avatar Feb 05 '20 10:02 AlexanderYakunin

Yes, that is the adjustment we need for our modifications to the document mailing.

wdet avatar Feb 05 '20 10:02 wdet

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.

bc-ghost avatar Feb 07 '20 06:02 bc-ghost

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.

bc-ghost avatar Feb 19 '20 14:02 bc-ghost