ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Bug] OnAfterEmailSentSuccesfully doesn't provide latest version of the "Email Item"

Open wdet opened this issue 6 years ago • 6 comments

When you sent a document via email then an email dialog opens. In this dialog you have the possibility to change information like the To address for example. In the OnAfterEmailSentSuccesfully event you don't receive this change, the provided "Email Item" still has the old value.

wdet avatar Jan 24 '20 10:01 wdet

Do you have any status update on this, please?

wdet avatar Feb 25 '20 10:02 wdet

Please be more detailed. We may not understand your issue, if you need to update TempEmailItem before send, you probably need to use this event

        IsHandled := false;
        OnBeforeSendEmail(TempEmailItem, IsFromPostedDoc, PostedDocNo, HideDialog, ReportUsage, EmailSentSuccesfully, IsHandled);
        if IsHandled then
            exit(EmailSentSuccesfully);

AlexanderYakunin avatar Apr 08 '20 07:04 AlexanderYakunin

I have added the following subscriber to OnAfterEmailSentSuccesfully

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Document-Mailing", 'OnAfterEmailSentSuccesfully', '', false, false)]
local procedure OnAfterEmailSentSuccesfully(var TempEmailItem: Record "Email Item" temporary; PostedDocNo: Code[20]; ReportUsage: Integer)
begin
    Message(TempEmailItem."Send to");
end;

I try to send a posted invoice via mail. I do this by navigating to the posted sales invoices and then send a mail via "Print/Send" => Send....

I confirm the next dialog with these settings. image

After this, the email dialog opens. image

In this window I change the To email address to another valid address and send the mail. The message shows the old email address instead of the new entered one.

wdet avatar Apr 16 '20 08:04 wdet

I've just tested this on BC 16.1 and this is still not working properly. The "old" version of the Email Item is retrieved. When will this be fixed?

daansaveyn avatar May 26 '20 08:05 daansaveyn

I think this is currently By Design, as TempEmailItem is only temporary table to pass parameters to Mail sending process and there is no easy way to return changed data back. So this is not a problem of existing event, but more deeper design question. I will forward this ask to another team focused on EMailing story.

AlexanderYakunin avatar Jun 05 '20 08:06 AlexanderYakunin

We are currently redoing our email story, to be released with the next major. This issue will be considered in the new implementation.

JesperSchulz avatar Jun 18 '20 08:06 JesperSchulz