{"title":"System.ClearAll() Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/system/system-clearall-method/","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/methods-auto/system/system-clearall-method, 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/methods-auto/system/system-clearall-method","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":"Clears all internal variables (except REC variables), keys, and filters in the object and in any associated objects, such as reports, pages, codeunits, and so on that contain AL code.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Syntax","slug":"syntax","at":244,"chars":114},{"level":2,"title":"Remarks","slug":"remarks","at":358,"chars":940},{"level":2,"title":"Related information","slug":"related-information","at":1298,"chars":134}],"text":"> Version: _Available or changed with runtime version 1.0._\nClears all internal variables (except REC variables), keys, and filters in the object and in any associated objects, such as reports, pages, codeunits, and so on that contain AL code.\n## Syntax\n```al\n System.ClearAll()\n```\n> NOTE\n> This method can be invoked without specifying the data type name.\n## Remarks\nClearAll works by calling the system-clear-joker-method repeatedly on each variable. However, this is not the case with codeunits, where the ClearAll method works by calling ClearAll inside the codeunit. It deletes the contents of the codeunit, whereas Clear only deletes the reference to the codeunit.\nClearAll does not affect or change values for variables in single instance codeunits.\nWhen a method is called repeatedly in the same transaction, the system retains all values for variables and filters in memory between calls. For example, this is used to assign numbers to entry numbers when posting. When you do not want to retain the values in memory, use the ClearAll method to clear them.\nFor information about the initial values of cleared variables, see the system-clear-joker-method. Take into consideration that fields in a record will be initialized with the ../../properties/devenv-initvalue-property of the field.\n## Related information\nsystem-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}