{"title":"CodeCop Warning AA0224","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/codecop-aa0224/","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-aa0224, 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-aa0224","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":"The count of option captions specified in the OptionCaption property is wrong.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"CodeCop Warning AA0224","slug":"codecop-warning-aa0224","at":0,"chars":1088},{"level":2,"title":"Description","slug":"description","at":104,"chars":94},{"level":2,"title":"Remarks","slug":"remarks","at":198,"chars":177},{"level":2,"title":"Example","slug":"example","at":375,"chars":532},{"level":2,"title":"Related information","slug":"related-information","at":907,"chars":181}],"text":"# CodeCop Warning AA0224\nThe count of option captions specified in the OptionCaption property is wrong.\n## Description\nThe count of option captions specified in the OptionCaption property is wrong.\n## Remarks\nThe number of option captions specified in the OptionCaption property must match the number of option values available for a variable or a field on a page or report.\n## Example\nThe following code sample will raise a warning because the number of option values available for the page field `\"VAT Posting\"` is two, while only one option caption is defined in the OptionCaption property.\n```al\npage 50100 MyPage\n{\n    layout\n    {\n        area(Content)\n        {\n            field(\"VAT Posting\"; postingOptions)\n            {\n                OptionCaption = 'Automatic VAT Entry';\n            }\n        }\n    }\n\n    var\n        postingOptions: Option \"Automatic VAT Entry\" , \"Manual VAT Entry\";\n}\n```\n## Related information\nCodeCop Analyzer<codecop>\n../properties/devenv-optioncaption-property\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}