Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Modification] Table 9500 "Email Item" - OnBeforeSend #26685

Open
Pieterheinevdm opened this issue Jun 17, 2024 · 0 comments
Open

[Event Modification] Table 9500 "Email Item" - OnBeforeSend #26685

Pieterheinevdm opened this issue Jun 17, 2024 · 0 comments
Labels
event-request Request for adding an event Integration GitHub request for Integration area

Comments

@Pieterheinevdm
Copy link

Pieterheinevdm commented Jun 17, 2024

Describe the request

regarding IntegrationEvent OnBeforeSend in table 9500 "Email Item"
can parameter EmailScenario made var?
and
can parameter Enqueue be added as var?

old:
[IntegrationEvent(false, false)]
local procedure OnBeforeSend(var EmailItem: Record "Email Item"; var HideMailDialog: Boolean; var MailManagement: Codeunit "Mail Management"; EmailScenario: Enum "Email Scenario"; var Result: Boolean; var IsHandled: Boolean)
begin
end;

new:
[IntegrationEvent(false, false)]
local procedure OnBeforeSend(var EmailItem: Record "Email Item"; var HideMailDialog: Boolean; var MailManagement: Codeunit "Mail Management"; var EmailScenario: Enum "Email Scenario"; var Enqueue: Boolean; var Result: Boolean; var IsHandled: Boolean)
begin
end;

Old:
procedure Send(HideMailDialog: Boolean; EmailScenario: Enum "Email Scenario"; Enqueue: Boolean) Result: Boolean
var
MailManagement: Codeunit "Mail Management";
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeSend(Rec, HideMailDialog, MailManagement, EmailScenario, Result, IsHandled);
if IsHandled then
exit(Result);
MailManagement.SendMailOrDownload(Rec, HideMailDialog, EmailScenario, Enqueue);
exit(MailManagement.IsSent());
end;

New:
procedure Send(HideMailDialog: Boolean; EmailScenario: Enum "Email Scenario"; Enqueue: Boolean) Result: Boolean
var
MailManagement: Codeunit "Mail Management";
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeSend(Rec, HideMailDialog, MailManagement, EmailScenario, Enqueue, Result, IsHandled);
if IsHandled then
exit(Result);
MailManagement.SendMailOrDownload(Rec, HideMailDialog, EmailScenario, Enqueue);
exit(MailManagement.IsSent());
end;

Additional context

so we can overwrite the EmailScenario in some cases
and/or we can set IsHandled to true but then we needed to know the value of Enqueue to call MailManagement.SendMailOrDownload ourself

Internal work item: AB#538782

@JesperSchulz JesperSchulz added event-request Request for adding an event Integration GitHub request for Integration area labels Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event Integration GitHub request for Integration area
Projects
None yet
Development

No branches or pull requests

2 participants