You must have heard. Codeunit 1 is a goner! And if you have not heard it – you must have read about it. Because it has been on Microsoft Docks for a while, and also there was a blog that Microsoft spent on it.
Well, before I managed to find these description, I was working on my own overview ;-). So let me share it – I do believe that I look at it from another angle.
Where are my events?
If we want to extend codeunit 1, we have been subscribing to events. And if not – you should have ;-). So, first question would be – where are the events that we were subscribing to??
Well, I made my own overview of all the published events in codeunit 1, and the mapping to the new event in the table below:
I indicated in red the ones that need a bit attention, as either they are not available, or are renamed.. .
Are there new events as well?
Yes! And quite many of them. I just don’t know how I can give you a complete overview of all the events “that could have been in codeunit 1, but are now spread over multiple codeunits.. “. So, let me just give you a few tips of where you could find such “generic” or “platform wide” or “…” events.
In my opinion, the below codeunits have these kind of events that I think are very interesting in a application-wide-context:
So. Just to help you … I created another list with events which I think are quite interesting for you. In bold, you see the ones that didn’t exist in Codeunit 1.
But that’s not all…
If you look for example into Codeunit “LoginManagement”, you’ll see that it subscribes to an event called “OnCompanyClose”, which is an event in codeunit “2000000003”.
I wasn’t able to export that codeunit (with powershell, nor with the classic client) – and even found a few more like those codeunits. In classic environment, this is what I saw:
So all these codeunits end with “Triggers” – which means in VSCode, we are able to access them with Intellisense like:
Here is an overview of all the events in these “system trigger codeunits”:
I’m not sure in how to use all of them – but it is a great help to simply look into the code of Busines Central, as most (if not all) of these events exist because Microsoft needed them. You can figure out how to use them, and in many cases, you’ll find what are the actual events you should use as a developer.