ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] codeunit 260 "Document-Mailing" OnBeforeFromReportSelectionUsage

Open auzhhv opened this issue 1 year ago • 5 comments

Describe the request

Can you add a event to be able to override the code that sets EmailScenario?

            // >>>>>>>>>>>>
            OnBeforeFromReportSelectionUsage(EmailScenario, IsHandled);
            if not IsHandled then
            // <<<<<<<<<<<<
            if Enum::"Report Selection Usage".Ordinals().Contains(ReportUsage) then
                EmailScenario := EmailScenarioMapping.FromReportSelectionUsage(Enum::"Report Selection Usage".FromInteger(ReportUsage));
            EmailSentSuccesfully := TempEmailItem.Send(HideDialog, EmailScenario, Enqueue);
            if EmailSentSuccesfully then
                OnAfterEmailSentSuccesfully(TempEmailItem, PostedDocNo, ReportUsage);

The best solution we be to not replace EmailScenario if it is not default

            // >>>>>>>>>>>>
            if EmailScenario <> EmailScenario::Default then
            // <<<<<<<<<<<<
            if Enum::"Report Selection Usage".Ordinals().Contains(ReportUsage) then
                EmailScenario := EmailScenarioMapping.FromReportSelectionUsage(Enum::"Report Selection Usage".FromInteger(ReportUsage));
            EmailSentSuccesfully := TempEmailItem.Send(HideDialog, EmailScenario, Enqueue);
            if EmailSentSuccesfully then
                OnAfterEmailSentSuccesfully(TempEmailItem, PostedDocNo, ReportUsage);

Additional context

When replacing EmailScenario in event OnBeforeSendEmail, it is set back to default because of the mentioned code. Internal work item: AB#562595

auzhhv avatar Jan 15 '25 13:01 auzhhv

@auzhhv sorry, this fell through the cracks. Can you confirm this is something you still need before I assign an engineer to look into the issue?

Aleyenda avatar Apr 10 '25 09:04 Aleyenda

Yes please 🙂


Fra: Aleyenda @.> Sendt: torsdag 10. april 2025 11:47 Til: microsoft/ALAppExtensions @.> Kopi: Håkon Hvitsten @.>; Mention @.> Emne: Re: [microsoft/ALAppExtensions] [Event Request] codeunit 260 "Document-Mailing" OnBeforeFromReportSelectionUsage (Issue #27947)

@auzhhvhttps://github.com/auzhhv sorry, this fell through the cracks. Can you confirm this is something you still need before I assign an engineer to look into the issue?

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/ALAppExtensions/issues/27947#issuecomment-2792183350, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AK7GG2HPKQODCEZ3CH6GYOT2YY44TAVCNFSM6AAAAABVHJVX3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOJSGE4DGMZVGA. You are receiving this because you were mentioned.Message ID: @.***>

[https://avatars.githubusercontent.com/u/15276632?s=20&v=4]Aleyenda left a comment (microsoft/ALAppExtensions#27947)https://github.com/microsoft/ALAppExtensions/issues/27947#issuecomment-2792183350

@auzhhvhttps://github.com/auzhhv sorry, this fell through the cracks. Can you confirm this is something you still need before I assign an engineer to look into the issue?

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/ALAppExtensions/issues/27947#issuecomment-2792183350, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AK7GG2HPKQODCEZ3CH6GYOT2YY44TAVCNFSM6AAAAABVHJVX3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOJSGE4DGMZVGA. You are receiving this because you were mentioned.Message ID: @.***>

auzhhv avatar Apr 23 '25 05:04 auzhhv

@auzhhv We started pushing back on IsHandled events, they are rather bad. There will be a documentation article on why exactly they are bad.

Can we revise this event to OnSetEmailScenario(EmailScenario, EmailScenarioSet)? In this way we have a clear purpose - Setting the email scenario.

I would rather change the implementaion if possible and move the event to codeunit 8891 "Email Scenario Mapping" procedure FromReportSelectionUsage(ReportSelectionUsage: Enum "Report Selection Usage"): Enum "Email Scenario"

This would cover more cases. What do you think?

nikolakukrika avatar Apr 24 '25 09:04 nikolakukrika

No problem solving it another way. If we can have a event so we can override it will work for us.

Håkon Hvitsten Systems Engineer Manager

+47 33 74 02 00 | +47 400 80 337 @.@.> www.auzilium.nohttp://auzilium.no/ Sentrum 2, 3185 Skoppum, Norge

[cid:7aea6bb1-af86-4e27-a3a7-9469b9c5baf4]

[Auzilium mail signatur.png]

[Microsoft Solutions Partner Business Application]


Fra: Nikola Kukrika @.> Sendt: torsdag 24. april 2025 11:24 Til: microsoft/ALAppExtensions @.> Kopi: Håkon Hvitsten @.>; Mention @.> Emne: Re: [microsoft/ALAppExtensions] [Event Request] codeunit 260 "Document-Mailing" OnBeforeFromReportSelectionUsage (Issue #27947)

[https://avatars.githubusercontent.com/u/39086991?s=20&v=4]nikolakukrika left a comment (microsoft/ALAppExtensions#27947)https://github.com/microsoft/ALAppExtensions/issues/27947#issuecomment-2826948376

@auzhhvhttps://github.com/auzhhv We started pushing back on IsHandled events, they are rather bad. There will be a documentation article on why exactly they are bad.

Can we revise this event to OnSetEmailScenario(EmailScenario, EmailScenarioSet)? In this way we have a clear purpose - Setting the email scenario.

I would rather change the implementaion if possible and move the event to codeunit 8891 "Email Scenario Mapping" procedure FromReportSelectionUsage(ReportSelectionUsage: Enum "Report Selection Usage"): Enum "Email Scenario"

This would cover more cases. What do you think?

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/ALAppExtensions/issues/27947#issuecomment-2826948376, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AK7GG2G57YVTQLYSEALRU2L23CUTVAVCNFSM6AAAAABVHJVX3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMRWHE2DQMZXGY. You are receiving this because you were mentioned.Message ID: @.***>

auzhhv avatar May 02 '25 10:05 auzhhv

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. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 34009.

JesperSchulz avatar May 13 '25 05:05 JesperSchulz