[Event Request] Codeunit 1509 Notification Entry Dispatcher - DispatchForNotificationType - Additional Notification Method
Hello,
In Notification Entry Dispatcher the Enum Notification Method Type is used. The enum can be extended, but in DispatchForNotificationType procedure it's not possible to handle other values. Therefor I would like to request a new event publisher OnDispatchNotificationMethod(NotificationMethodType: Enum "Notification Method Type"; NotificationEntry: Record "Notification Entry"), like this:
local procedure DispatchForNotificationType(NotificationType: Enum "Notification Entry Type"; UserSetup: Record "User Setup"; SenderUserID: Code[50])
var
NotificationEntry: Record "Notification Entry";
NotificationSetup: Record "Notification Setup";
begin
NotificationEntry.SetRange("Recipient User ID", UserSetup."User ID");
NotificationEntry.SetRange(Type, NotificationType);
if SenderUserID <> '' then
NotificationEntry.SetRange("Sender User ID", SenderUserID);
DeleteOutdatedApprovalNotificationEntires(NotificationEntry);
if not NotificationEntry.FindFirst then
exit;
FilterToActiveNotificationEntries(NotificationEntry);
NotificationSetup.GetNotificationTypeSetupForUser(NotificationType, NotificationEntry."Recipient User ID");
case NotificationSetup."Notification Method" of
NotificationSetup."Notification Method"::Email:
CreateMailAndDispatch(NotificationEntry, UserSetup."E-Mail");
NotificationSetup."Notification Method"::Note:
CreateNoteAndDispatch(NotificationEntry);
// --- NEW CODE START
else
OnDispatchNotificationMethod(NotificationSetup."Notification Method", NotificationEntry);
// --- NEW CODE END
end;
end;
I know it would be much better to use an interface instead, but I think this will cause to much re-design and using a event publisher like this at least give the possibility to handle additional notification methods.
Thank you in advance.
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.