{"title":"SubType property on codeunits","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/properties/devenv-subtype-codeunit-property/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-subtype-codeunit-property, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-subtype-codeunit-property","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Learn how the SubType property defines the purpose and runtime behavior of a codeunit in Dynamics 365 Business Central and review its values.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Applies to","slug":"applies-to","at":86,"chars":25},{"level":2,"title":"Property value","slug":"property-value","at":111,"chars":364},{"level":2,"title":"Syntax","slug":"syntax","at":475,"chars":38},{"level":2,"title":"Remarks","slug":"remarks","at":513,"chars":1581},{"level":2,"title":"Related information","slug":"related-information","at":2094,"chars":291}],"text":"> Version: _Available from runtime version 1.0._\nSpecifies the purpose of a codeunit.\n## Applies to\n Codeunits\n## Property value\nValue|Description\nNormal|Defines a general-purpose codeunit. This value is the default.\nTest|Defines a codeunit that contains test methods.\nTestRunner|Defines a codeunit that runs one or more test codeunits.\nUpgrade|Defines a codeunit that contains data-upgrade triggers.\nInstall|Defines a codeunit that contains extension-installation triggers.\n## Syntax\n```al\nSubType = Normal;\n```\n## Remarks\nCodeunits that have the SubType property set to Test or TestRunner support automated testing of your application.\n A Test codeunit contains the test methods that test your application. When a test codeunit runs, it executes the OnRun trigger, and then executes each test method in the codeunit. Unlike a normal codeunit, where a failing method terminates the codeunit, a test codeunit continues to run its remaining test methods even if one test method fails. See ../devenv-test-codeunits-and-test-methods.\n A TestRunner codeunit manages the execution of one or more test codeunits and can integrate with external test management and reporting frameworks. It supports the OnBeforeTestRun and OnAfterTestRun triggers, which run immediately before and after each test codeunit runs, so you can do preprocessing and postprocessing, such as initialization or logging test results. See Test runner codeunits<../devenv-testrunner-codeunits>.\nAn Upgrade codeunit contains the code that upgrades data from a previous extension version so that it's compatible with the current version. Upgrade codeunits support system triggers, such as OnUpgradePerCompany and OnUpgradePerDatabase, that run when you start the data upgrade process. See ../devenv-upgrading-extensions.\nAn Install codeunit contains code that runs operations, such as initializing data, when an extension is installed for the first time or reinstalled. Install codeunits support the OnInstallAppPerCompany and OnInstallAppPerDatabase triggers. See Writing extension install code<../devenv-extension-install-code>.\n## Related information\ndevenv-codeunit-properties\n../devenv-test-codeunits-and-test-methods\nTest runner codeunits<../devenv-testrunner-codeunits>\nUpgrade codeunits<../devenv-upgrading-extensions>\n../devenv-extension-install-code\nSubType property for BLOB fields<devenv-subtype-blob-property>"}