{"title":"CodeCop Warning AA0021","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/codecop-aa0021/","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/analyzers/codecop-aa0021, 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/analyzers/codecop-aa0021","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":"Variable declarations should be ordered by type.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"CodeCop Warning AA0021","slug":"codecop-warning-aa0021","at":0,"chars":656},{"level":2,"title":"Description","slug":"description","at":74,"chars":157},{"level":2,"title":"Remarks","slug":"remarks","at":231,"chars":288},{"level":2,"title":"Related information","slug":"related-information","at":519,"chars":137}],"text":"# CodeCop Warning AA0021\nVariable declarations should be ordered by type.\n## Description\nVariable declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables.\n## Remarks\nObject and complex variable types must be listed first, and then simple variables. The order is: Record, Report, Codeunit, XmlPort, Page, Query, Notification, BigText, DateFormula, RecordId, RecordRef, FieldRef, and FilterPageBuilder. The rest of the variables are not sorted.\n## Related information\nCodeCop Analyzer<codecop>\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}