New system events replace Codeunit 1 in Business Central October’18 release

When you start upgrading to Business Central on-premises, you’ll notice that Codeunit 1 ApplicationManagement is missing. Not to worry, this is not a ‘bug’, it is by design. We’re refactoring the application as part of our move to modern development and to enable extensions to subscribe to events that were formerly handled by functions in codeunit 1.

The old ApplicationManagement codeunit has been retired, and new ‘system’ codeunits have been introduced in the 2 billion range.

These special codeunits are created by C/SIDE when a database is created so you will always have them, compiled, and ready to go. These new system codeunits do not contain code, all they contain are event publishers. Business Central Server will now call these event publishers instead of calling the respective functions in Codeunit 1 ApplicationManagement directly.

We have added subscribers to these new business events in various places in the application code to ensure all the functionality still works as before, no functionality was removed. Most of the real business logic was already moved out of the ApplicationManagement codeunit so these subscribers were added where the business logic really resides. The integration events were also moved from Codeunit 1 to their respective new homes.

You can find a detailed mapping of where each function moved in the table at the end of this blog post, and of course it will be part of the docs for the release of Business Central October’18. The list will be in the upgrade docs, so stay tuned for the update of the developer and ITPro docs!

The new ‘system’ codeunits are special in more ways than one. You will not be able to customize them as you would other codeunits. You also should not directly subscribe to the events in these codeunits either. While technically possible as of now, we will block this in the future which would be a breaking change for you. Instead you should subscribe to one of the integration events which now reside next to the business logic. The reason for this is to ensure the correct ordering of events and to provide before/after events where appropriate.

Of course this is a big change in how the server interacts with the application and you will need to adjust your customizations and extensions to this new way of working. You can find help and more information on how to do technical upgrade in the developer and ITPro docs for Business Central October’18 release.

Which functions become which events?

The following table describes the mapping from codeunit 1 to the new events:

Codeunit 1 function nameNew object typeNew object IDNew object nameNew function name
CompanyOpenCodeunit40LogInManagementCompanyOpen
GetSystemIndicatorCodeunit40LogInManagementGetSystemIndicator
CompanyCloseCodeunit40LogInManagementCompanyClose
FindPrinterCodeunit44ReportManagementGetPrinterName
ApplicationVersionCodeunit9015Application System ConstantsApplicationVersion
CustomApplicationVersionN/AN/AN/AN/A
ReleaseVersionCodeunit9015Application System ConstantsReleaseVersion
ApplicationBuildCodeunit9015Application System ConstantsApplicationBuild
CustomApplicationBuildN/AN/AN/AN/A
ApplicationLanguageCodeunit43LanguageManagementApplicationLanguage
DefaultRoleCenterCodeunit9170Conf./Personalization Mgt.DefaultRoleCenterID
MakeDateTimeTextCodeunit41TextManagementMakeDateTimeText
GetSeparateDateTimeCodeunit41TextManagementGetSeparateDateTime
MakeDateTextCodeunit41TextManagementMakeDateText
MakeTimeTextCodeunit41TextManagementMakeTimeText
MakeTextCodeunit41TextManagementMakeText
MakeDateTimeFilterCodeunit41TextManagementMakeDateTimeFilter
MakeDateFilterCodeunit41TextManagementMakeDateFilter
MakeTextFilterCodeunit41TextManagementMakeTextFilter
MakeCodeFilterCodeunit41TextManagementMakeTextFilter
MakeTimeFilterCodeunit41TextManagementMakeTimeFilter
AutoFormatTranslateCodeunit45AutoFormatManagementAutoFormatTranslate
ReadRoundingCodeunit45AutoFormatManagementReadRounding
CaptionClassTranslateCodeunit42CaptionManagementCaptionClassTranslate
GetCueStyleCodeunit9701Cue SetupGetCueStyle
SetGlobalLanguageCodeunit43LanguageManagementSetGlobalLanguage
ValidateApplicationlLanguageCodeunit43LanguageManagementValidateApplicationLanguage
LookupApplicationlLanguageCodeunit43LanguageManagementLookupApplicationLanguage
GetGlobalTableTriggerMaskCodeunit49GlobalTriggerManagementGetGlobalTableTriggerMask
OnGlobalInsertCodeunit49GlobalTriggerManagementOnGlobalInsert
OnGlobalModifyCodeunit49GlobalTriggerManagementOnGlobalModify
OnGlobalDeleteCodeunit49GlobalTriggerManagementOnGlobalDelete
OnGlobalRenameCodeunit49GlobalTriggerManagementOnGlobalRename
GetDatabaseTableTriggerSetupCodeunit49GlobalTriggerManagementGetDatabaseTableTriggerSetup
OnDatabaseInsertCodeunit49GlobalTriggerManagementOnDatabaseInsert
OnDatabaseModifyCodeunit49GlobalTriggerManagementOnDatabaseModify
OnDatabaseDeleteCodeunit49GlobalTriggerManagementOnDatabaseDelete
OnDatabaseRenameCodeunit49GlobalTriggerManagementOnDatabaseRename
OnDebuggerBreakCodeunit9500Debugger ManagementProcessOnDebuggerBreak
LaunchDebuggerCodeunit9500Debugger ManagementOpenDebugger
OpenSettingsCodeunit9170Conf./Personalization Mgt.OpenSettings
OpenContactMSSalesCodeunit50SaaS Log In ManagementOpenContactMSSales
InvokeExtensionInstallationCodeunit2501ExtensionMarketplaceMgmtInvokeExtensionInstallation
CustomizeChartCodeunit9180Generic Chart MgtCustomizeChart
HasCustomLayoutCodeunit44ReportManagementHasCustomLayout
MergeDocumentCodeunit44ReportManagementMergeDocument
ReportGetCustomRdlcCodeunit44ReportManagementReportGetCustomRdlc
ReportSchedulerCodeunit44ReportManagementScheduleReport
OnBeforeOpenSettingsCodeunit9170Conf./Personalization Mgt.OnBeforeOpenSettings
OnAfterGetApplicationVersionCodeunit9015Application System ConstantsOnAfterGetApplicationVersion
OnBeforeCompanyOpenCodeunit40LogInManagementOnBeforeCompanyOpen
OnAfterCompanyOpenCodeunit40LogInManagementOnAfterCompanyOpen
OnRoleCenterOpenCodeunit9170Conf./Personalization Mgt.OnRoleCenterOpen
OnBeforeCompanyCloseCodeunit40LogInManagementOnBeforeCompanyClose
OnAfterCompanyCloseCodeunit40LogInManagementOnAfterCompanyClose
OnAfterGetSystemIndicatorTable79Company InformationOnAfterGetSystemIndicator
OnAfterFindPrinterCodeunit44ReportManagementOnAfterGetPrinterName
OnAfterGetDefaultRoleCenterCodeunit9170Conf./Personalization Mgt.OnAfterGetDefaultRoleCenter
OnAfterMakeDateTextN/AN/AN/AN/A
OnAfterMakeTimeTextN/AN/AN/AN/A
OnAfterMakeTextN/AN/AN/AN/A
OnAfterMakeDateTimeFilterCodeunit41TextManagementOnAfterMakeDateTimeFilter
OnAfterMakeDateFilterCodeunit41TextManagementOnAfterMakeDateFilter
OnAfterMakeTextFilterCodeunit41TextManagementOnAfterMakeTextFilter
OnAfterMakeCodeFilterN/AN/AN/AN/A
OnAfterMakeTimeFilterCodeunit41TextManagementOnAfterMakeTimeFilter
OnAfterAutoFormatTranslateCodeunit45AutoFormatManagementOnAfterAutoFormatTranslate
OnAfterCaptionClassTranslateCodeunit42CaptionManagementOnAfterCaptionClassTranslate
OnAfterGetGlobalTableTriggerMaskCodeunit49GlobalTriggerManagementOnAfterGetGlobalTableTriggerMask
OnAfterOnGlobalInsertCodeunit49GlobalTriggerManagementOnAfterOnGlobalInsert
OnAfterOnGlobalModifyCodeunit49GlobalTriggerManagementOnAfterOnGlobalModify
OnAfterOnGlobalDeleteCodeunit49GlobalTriggerManagementOnAfterOnGlobalDelete
OnAfterOnGlobalRenameCodeunit49GlobalTriggerManagementOnAfterOnGlobalRename
OnAfterGetDatabaseTableTriggerSetupCodeunit49GlobalTriggerManagementOnAfterGetDatabaseTableTriggerSetup
OnAfterOnDatabaseInsertCodeunit49GlobalTriggerManagementOnAfterOnDatabaseInsert
OnAfterOnDatabaseModifyCodeunit49GlobalTriggerManagementOnAfterOnDatabaseModify
OnAfterOnDatabaseDeleteCodeunit49GlobalTriggerManagementOnAfterOnDatabaseDelete
OnAfterOnDatabaseRenameCodeunit49GlobalTriggerManagementOnAfterOnDatabaseRename
OnAfterHasCustomLayoutCodeunit44ReportManagementOnAfterHasCustomLayout
OnAfterReportGetCustomRdlcTable9650Custom Report LayoutOnAfterReportGetCustomRdlc
OnBeforeOnDatabaseInsertCodeunit49GlobalTriggerManagementOnBeforeOnDatabaseInsert
OnBeforeOnDatabaseModifyCodeunit49GlobalTriggerManagementOnBeforeOnDatabaseModify
OnBeforeOnDatabaseDeleteCodeunit49GlobalTriggerManagementOnBeforeOnDatabaseDelete
OnBeforeOnDatabaseRenameCodeunit49GlobalTriggerManagementOnBeforeOnDatabaseRename
OnEditInExcelCodeunit6710ODataUtilityOnEditInExcel
OnInstallAppPerDatabaseN/AN/AN/AN/A
OnInstallAppPerCompanyN/AN/AN/AN/A
OnCheckPreconditionsPerDatabaseCodeunit9900Data Upgrade Mgt.OnCheckPreconditionsPerDatabase
OnCheckPreconditionsPerCompanyCodeunit9900Data Upgrade Mgt.RaiseOnCheckPreconditionsPerCompany
OnUpgradePerDatabaseCodeunit9900Data Upgrade Mgt.OnUpgradePerDatabase
OnUpgradePerCompanyCodeunit9900Data Upgrade Mgt.OnUpgradePerCompany
OnValidateUpgradePerDatabaseCodeunit9900Data Upgrade Mgt.OnValidateUpgradePerDatabase
OnValidateUpgradePerCompanyCodeunit9900Data Upgrade Mgt.OnValidateUpgradePerCompany


19. September 2018: The table has been updated with object names so the new functions are more easily found in the Business Central development environment.