3
On tableextension or pageextension objects, we are able to write to platform events like OnAfterAction, OnOpenPage, OnAfterInsert, and so on.

But for IntegrationEvent or BusinessEvent, we have to create codeunits.

If I take as an example the page "Sales Order Subform", I would like being able to do this:

pageextension 50000 "Sales Order Subform PTE" extends "Sales Order Subform"
{
//OnBeforeSetDefaultType is an IntegrationEvent declared in Sales Order Subform page
trigger OnBeforeSetDefaultType(var SalesLine: Record "Sales Line"; var xSalesLine: Record "Sales Line"; var IsHandled: Boolean)
begin
//Do something..
end;
}
Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team

Comments

N

> On tableextension or pageextension objects, we are able to write to platform events like OnAfterAction, OnOpenPage, OnAfterInsert, and so on.

Those are triggers, right? not platform events. They just happen to have the same names :-)

I understand this helps with organising source code into related files instead of larger codeunits, but I don't know how well it'll scale, if lots of single subscribers mean making lots of small extensions and using up IDs accordingly. Also, it'll mean code in an extension object may not be movable to a codeunit later (e.g. if IDs are in short supply), as presumably it would have additional access to protected variables, controls, etc - which the codeunit would not. I've been trying to avoid putting stuff in extension objects if a codeunit could suffice, as it looks like doing so helps avoid coupling.

Of course, we'd be free not to use the suggested functionality! but just noting some potential issues it may raise.

Category: Development