[Event Request] CU1510 OnBeforeGetDocumentTypeAndNumber
In CU 1510 Notification Management, function GetDocumentTypeAndNumber has an event OnGetDocumentTypeAndNumber to handle tables that aren't included in the function.
Does not however allow us to replace the DocumentType and DocumentNo in the instance that we want to show something different in these two parameters for an existing handled table.
OnBeforeGetDocumentTypeAndNumber(NotificationEntry,RecRef,DocumentType,DocumentNo,IsHandled); at the beginning of the function would allow us to do this.
In context: During approval workflow, we convert a purchase quote to order and send a notification to the requestee. This should say "Purchase Quote x was approved", but it displays the created Purchase Order instead.
I want to use a manual event binding to display the Quote No. instead when this specific workflow step is called.
At the moment I am having to create a copy of the Notification Email report just so I can handle this.
I cannot implement this as NotificationEntry is not available in this context OnBeforeGetDocumentTypeAndNumber(NotificationEntry,RecRef,DocumentType,DocumentNo,IsHandled);
The function GetDocumentTypeAndNumber is only called in two places: Codeunit 1509 Notification Entry Dispatcher - CreateNoteBody Report 1320 Notification Email - SetDocumentTypeAndNumber
Notification Entry is used in both of these functions; could the NotificationEntry parameter be added to GetDocumentTypeAndNumber, and then passed through from these functions?

I cannot change signature of External function
[External] GetDocumentTypeAndNumber(VAR RecRef : RecordRef;VAR DocumentType : Text;VAR DocumentNo : Text)
I can understand the reasoning, since you don't want to break partners existing functionality, but if changes like that can't be made I don't see how this software can improve efficiently without hacky solutions.
Surely if the function signature is updated, partner development must be updated to match; as should be expected with evolving software like this.
Without changing this function, or adding a new function to supplant it, the only way I can see to do this is to set a global NotificationEntry variable in the NotificationManagement Codeunit, and then using this in the requested event.


This is far from the neatest solution, but you've stated you can't implement the neatest solution.
An alternative scenario that is specific to our use case is to add the following event to Report 1320 Notification Email
However this does not support instances where Notifications are sent as Notes rather than emails. So only Notification Emails can be customised.
OnAfterSetDocumentName(var "Notification Entry", var RecRef, var DocumentName, var DocumentType, var DocumentNo); in the SetDocumentTypeAndNumber function

To explain in context, our Purchase Quote Approval Workflow has a step where the Quote is approved and converted to an Order; we want to Notification Email to display this fact. We are currently achieving this by making a carbon copy of Report 1320, JUST to add this event into it, and then we are manually sending the Notification Email via SMTP, rather than using the standard Notification Functionality; this also bypasses aggregate notifications, and while it sends the email, the Requests to Approve page hangs.

Having to copy an entire report just to add one event, and furthermore having to bypass standard Notification Emails with our own, is hardly an ideal scenario.