Transitioning from codeunit 1 to system codeunits

Note

  • If you're coming from version 13 or earlier, Business Central Spring 2019 (v14) is a required step to upgrade to the latest version of Business Central. However, mainstream support for version 14 ends in October 2023, and minor updates to the version are no longer available. New customers can't use version 14 in production, but only as a path for upgrading to latest version. Existing customers on version 14 remain supported by Microsoft as defined in the Fixed Lifecycle Policy.

With Business Central, codeunit 1 Application Management is removed and replaced with new System codeunits. No functionality is removed with this change. All system method triggers, event publishers, and their code are moved to other codeunits.

However, this change affects the upgrade process from Dynamics NAV and how you develop from now on.

Overview

The foundation of this change is events - publishers and subscribers. System codeunits don't contain code. They only contain event publishers. Instead of running codeunit 1 and calling respective functions, Business Central Server runs system codeunits. In turn, the system codeunits raise published events. There are various management codeunits that subscribe to these events. Like codeunit 1, these subscriber codeunits contain method triggers and integration event publishers. They can call application functionality and raise events. The following figure illustrates the process:

[System event publishers.]

About system codeunits

  • They have IDs in the two billion range.
  • You can't modify them.
  • Currently, we don't recommend that code subscribes to the events in the new system codeunits 2000000001..2000000010 directly. Although not blocked, it might be in a future release. Instead, you should subscribe to one of the integration events.

Mapping Codeunit 1 method triggers to events

The following table lists the mappings between the codeunit 1 triggers and the new method triggers/publishers in the management codeunits.

Codeunit 1 triggerNew codeunit IDNew codeunit nameNew method
CompanyClose40LogInManagementCompanyClose
CompanyOpen40LogInManagementCompanyOpen
GetSystemIndicator40LogInManagementGetSystemIndicator
OnAfterCompanyClose40LogInManagementOnAfterCompanyClose
OnAfterCompanyOpen40LogInManagementOnAfterCompanyOpen
OnBeforeCompanyClose40LogInManagementOnBeforeCompanyClose
OnBeforeCompanyOpen40LogInManagementOnBeforeCompanyOpen
FindPrinter44ReportManagementGetPrinterName
ApplicationVersion9015Application System ConstantsApplicationVersion
CustomApplicationVersionN/AN/A
ReleaseVersion9015Application System ConstantsReleaseVersion
ApplicationBuild9015Application System ConstantsApplicationBuild
CustomApplicationBuildN/AN/A
ApplicationLanguage43LanguageManagementApplicationLanguage
DefaultRoleCenter9170Conf./Personalization Mgt.DefaultRoleCenterID
MakeDateTimeText41TextManagementMakeDateTimeText
GetSeparateDateTime41TextManagementGetSeparateDateTime
MakeDateText41TextManagementMakeDateText
MakeTimeText41TextManagementMakeTimeText
MakeText41TextManagementMakeText
MakeDateTimeFilter41TextManagementMakeDateTimeFilter
MakeDateFilter41TextManagementMakeDateFilter
MakeTextFilter41TextManagementMakeTextFilter
MakeCodeFilter41TextManagementMakeTextFilter
MakeTimeFilter41TextManagementMakeTimeFilter
AutoFormatTranslate45AutoFormatManagementAutoFormatTranslate
ReadRounding45AutoFormatManagementReadRounding
CaptionClassTranslate42CaptionManagementCaptionClassTranslate
GetCueStyle9701Cue SetupGetCueStyle
SetGlobalLanguage43LanguageManagementSetGlobalLanguage
ValidateApplicationlLanguage43LanguageManagementValidateApplicationLanguage
LookupApplicationlLanguage43LanguageManagementLookupApplicationLanguage
GetGlobalTableTriggerMask49GetGlobalTableTriggerMask
OnGlobalInsert49GlobalTriggerManagementOnGlobalInsert
OnGlobalModify49GlobalTriggerManagementOnGlobalModify
OnGlobalDelete49GlobalTriggerManagementOnGlobalDelete
OnGlobalRename49GlobalTriggerManagementOnGlobalRename
GetDatabaseTableTriggerSetup49GlobalTriggerManagementGetDatabaseTableTriggerSetup
OnDatabaseInsert49GlobalTriggerManagementOnDatabaseInsert
OnDatabaseModify49GlobalTriggerManagementOnDatabaseModify
OnDatabaseDelete49GlobalTriggerManagementOnDatabaseDelete
OnDatabaseRename49GlobalTriggerManagementOnDatabaseRename
OnDebuggerBreakN/AN/A
LaunchDebuggerN/AN/A
OpenSettings9170Conf./Personalization Mgt.OpenSettings
OpenContactMSSales50SaaS Log In ManagementOpenContactMSSales
InvokeExtensionInstallation2501ExtensionMarketplaceMgmtInvokeExtensionInstallation
CustomizeChart9180Generic Chart MgtCustomizeChart
HasCustomLayout44ReportManagementHasCustomLayout
MergeDocument44ReportManagementMergeDocument
ReportGetCustomRdlc44ReportManagementReportGetCustomRdlc
ReportScheduler44ReportManagementScheduleReport
OnBeforeOpenSettings9170Conf./Personalization Mgt.OnBeforeOpenSettings
OnAfterGetApplicationVersion9015Application System ConstantsOnAfterGetApplicationVersion
OnRoleCenterOpen9170Conf./Personalization Mgt.OnRoleCenterOpen
OnAfterGetSystemIndicator79OnAfterGetSystemIndicator
OnAfterFindPrinter44ReportManagementOnAfterGetPrinterName
OnAfterGetDefaultRoleCenter9170Conf./Personalization Mgt.OnAfterGetDefaultRoleCenter
OnAfterMakeDateTextN/AN/A
OnAfterMakeTimeTextN/AN/A
OnAfterMakeTextN/AN/A
OnAfterMakeDateTimeFilter41TextManagementOnAfterMakeDateTimeFilter
OnAfterMakeDateFilter41TextManagementOnAfterMakeDateFilter
OnAfterMakeTextFilter41TextManagementOnAfterMakeTextFilter
OnAfterMakeCodeFilterN/AN/A
OnAfterMakeTimeFilter41TextManagementOnAfterMakeTimeFilter
OnAfterAutoFormatTranslate45AutoFormatManagementOnAfterAutoFormatTranslate
OnAfterCaptionClassTranslate42CaptionManagementOnAfterCaptionClassTranslate
OnAfterGetGlobalTableTriggerMask49GlobalTriggerManagementOnAfterGetGlobalTableTriggerMask
OnAfterOnGlobalInsert49GlobalTriggerManagementOnAfterOnGlobalInsert
OnAfterOnGlobalModify49GlobalTriggerManagementOnAfterOnGlobalModify
OnAfterOnGlobalDelete49GlobalTriggerManagementOnAfterOnGlobalDelete
OnAfterOnGlobalRename49GlobalTriggerManagementOnAfterOnGlobalRename
OnAfterGetDatabaseTableTriggerSetup49GlobalTriggerManagementOnAfterGetDatabaseTableTriggerSetup
OnAfterOnDatabaseInsert49GlobalTriggerManagementOnAfterOnDatabaseInsert
OnAfterOnDatabaseModify49GlobalTriggerManagementOnAfterOnDatabaseModify
OnAfterOnDatabaseDelete49GlobalTriggerManagementOnAfterOnDatabaseDelete
OnAfterOnDatabaseRename49GlobalTriggerManagementOnAfterOnDatabaseRename
OnAfterHasCustomLayout44ReportManagementOnAfterHasCustomLayout
OnAfterReportGetCustomRdlc9650Edit MS Word Report LayoutOnAfterReportGetCustomRdlc
OnBeforeOnDatabaseInsert49GlobalTriggerManagementOnBeforeOnDatabaseInsert
OnBeforeOnDatabaseModify49GlobalTriggerManagementOnBeforeOnDatabaseModify
OnBeforeOnDatabaseDelete49GlobalTriggerManagementOnBeforeOnDatabaseDelete
OnBeforeOnDatabaseRename49GlobalTriggerManagementOnBeforeOnDatabaseRename
OnEditInExcel6710OnEditInExcel
OnInstallAppPerDatabaseN/AN/A
OnInstallAppPerCompanyN/AN/A
OnCheckPreconditionsPerDatabase9900OnCheckPreconditionsPerDatabase
OnCheckPreconditionsPerCompany9900RaiseOnCheckPreconditionsPerCompany
OnUpgradePerDatabase9900OnUpgradePerDatabase
OnUpgradePerCompany9900OnUpgradePerCompany
OnValidateUpgradePerDatabase9900OnValidateUpgradePerDatabase
OnValidateUpgradePerCompany9900OnValidateUpgradePerCompany

What does this mean for upgrade?

Full upgrade - application code and data

Move custom logic from the old codeunit 1 to the management codeunits and methods. Change custom code that calls into codeunit 1 to call or subscribe to the new methods. You can do this step as part of the application code upgrade.

Technical upgrade

After you convert the old database to the Business Central platform, import and compile the replacement codeunit 1 object. You get the replacement object from Codeunit 1 Replacement.

Converting a Database