{"title":"AppSourceCop Error AS0095","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/appsourcecop-as0095/","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/appsourcecop-as0095, 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/appsourcecop-as0095","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 access modifier of a table field cannot be changed to a value that provides less access because it will break dependent extensions.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"AppSourceCop Error AS0095","slug":"appsourcecop-error-as0095","at":0,"chars":6289},{"level":2,"title":"Description","slug":"description","at":121,"chars":213},{"level":2,"title":"Remarks","slug":"remarks","at":334,"chars":394},{"level":2,"title":"Code examples triggering the rule","slug":"code-examples-triggering-the-rule","at":728,"chars":2093},{"level":3,"title":"Example 1: Reducing the Access Level to lower than Public","slug":"example-1-reducing-the-access-level-to-lower-than-public","at":765,"chars":672},{"level":3,"title":"Example 2: Reducing the Access Level to lower than Protected","slug":"example-2-reducing-the-access-level-to-lower-than-protected","at":1437,"chars":844},{"level":3,"title":"Example 3: Reducing the Access Level to lower than Public of a field defined in TableExtension","slug":"example-3-reducing-the-access-level-to-lower-than-public-of-a-field-defined-in-tableextension","at":2281,"chars":540},{"level":2,"title":"Code Examples that don't trigger the rule","slug":"code-examples-that-dont-trigger-the-rule","at":2821,"chars":3321},{"level":3,"title":"Example 1: Exposing the table for the first time","slug":"example-1-exposing-the-table-for-the-first-time","at":2866,"chars":691},{"level":3,"title":"Example 2: Changing the Access level from Local to Internal or vice versa","slug":"example-2-changing-the-access-level-from-local-to-internal-or-vice-versa","at":3557,"chars":555},{"level":3,"title":"Example 3: Changing the Access Level to Public or Protected from lower Access Level","slug":"example-3-changing-the-access-level-to-public-or-protected-from-lower-access-level","at":4112,"chars":508},{"level":3,"title":"Example 4: Changing the Access Level to Public from Protected","slug":"example-4-changing-the-access-level-to-public-from-protected","at":4620,"chars":459},{"level":3,"title":"Example 5: Changing the Access Level to Public or Protected from a lower access level in a table extension","slug":"example-5-changing-the-access-level-to-public-or-protected-from-a-lower-access-level-in-a-table-extension","at":5079,"chars":557},{"level":3,"title":"Example 6: Changing the Access Level to Public from Protected in a table extension","slug":"example-6-changing-the-access-level-to-public-from-protected-in-a-table-extension","at":5636,"chars":506},{"level":2,"title":"Related information","slug":"related-information","at":6142,"chars":147}],"text":"# AppSourceCop Error AS0095\nThe access modifier of a table field cannot be changed to a value that provides less access.\n## Description\nThe access modifier of a table field cannot be changed to a value that provides less access because it will break dependent extensions. You can only change the accessibility to provide more access.\n## Remarks\nThis rule verifies that the Access property of a field in a table or table extension has not been reduced between revisions. This rule only validates table fields if the table Access property is set to Public in the baseline extension. For more information about different access levels for both fields and tables, see Using Access Modifiers in AL<../devenv-using-access-modifiers>.\n## Code examples triggering the rule\n### Example 1: Reducing the Access Level to lower than Public\nVersion 1.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public; // If omitted the default value is Public\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Public;\n        }\n    }\n}\n```\nVersion 2.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public; // If omitted the default value is Public\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Protected; // or Local, Internal\n        }\n    }\n}\n```\nReducing the Access of a field in a Table will result in breaking extensions that are already using the field.\n### Example 2: Reducing the Access Level to lower than Protected\nVersion 1.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public; // If omitted the default value is Public\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Protected;\n        }\n    }\n}\n\n```\nVersion 2.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public; // If omitted the default value is Public\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Local; // or Internal\n        }\n    }\n}\n```\nReducing the Access level of the field might result in breaking existing scenarios where a dependent table extension defined in other application extension references this field. This will result in compilation error AL0161. The same rule applies to fields defined in a table extension.\n### Example 3: Reducing the Access Level to lower than Public of a field defined in TableExtension\nVersion 1.0 of the extension:\n```al\ntableextension 50126 MyTableExtension extends MyTable\n{\n    fields\n    {\n        field(2; OtherField; Integer)\n        {\n            Access = Public;\n        }\n    }\n}\n```\nVersion 2.0 of the extension:\n```al\ntableextension 50126 MyTableExtension extends MyTable\n{\n    fields\n    {\n        field(2; OtherField; Integer)\n        {\n            Access = Protected; // or Local, Internal\n        }\n    }\n}\n```\n## Code Examples that don't trigger the rule\n### Example 1: Exposing the table for the first time\nVersion 1.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Internal;\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Public;\n        }\n    }\n}\n```\nVersion 2.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public;\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Protected; // or any other access modifier\n        }\n    }\n}\n```\nChanging the Access level from Internal to Public on MyTable means that we are exposing the table for first time, so we cannot reduce the access level of the field since it has already indirectly been Internal.\n### Example 2: Changing the Access level from Local to Internal or vice versa\nVersion 1.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public;\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Local;\n        }\n    }\n}\n```\nVersion 2.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public;\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Internal;\n        }\n    }\n}\n```\nChanging Access level from Local to Internal or vice versa will not trigger the rule.\n### Example 3: Changing the Access Level to Public or Protected from lower Access Level\nVersion 1.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public;\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Local; // or Internal\n        }\n    }\n}\n```\nVersion 2.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public;\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Public; // or Protected\n        }\n    }\n}\n```\n### Example 4: Changing the Access Level to Public from Protected\nVersion 1.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public;\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Protected;\n        }\n    }\n}\n```\nVersion 2.0 of the extension:\n```al\ntable 50122 MyTable\n{\n    Access = Public;\n    fields\n    {\n        field(1; FirstField; Code[1])\n        {\n            Access = Public;\n        }\n    }\n}\n```\n### Example 5: Changing the Access Level to Public or Protected from a lower access level in a table extension\nVersion 1.0 of the extension:\n```al\ntableextension 50126 MyTableExtension extends MyTable\n{\n    fields\n    {\n        field(2; OtherField; Integer)\n        {\n            Access = Local; // or Internal\n        }\n    }\n}\n```\nVersion 2.0 of the extension:\n```al\ntableextension 50126 MyTableExtension extends MyTable\n{\n    fields\n    {\n        field(2; OtherField; Integer)\n        {\n            Access = Public; // or Protected\n        }\n    }\n}\n```\n### Example 6: Changing the Access Level to Public from Protected in a table extension\nVersion 1.0 of the extension:\n```al\ntableextension 50126 MyTableExtension extends MyTable\n{\n    fields\n    {\n        field(2; OtherField; Integer)\n        {\n            Access = Protected;\n        }\n    }\n}\n```\nVersion 2.0 of the extension:\n```al\ntableextension 50126 MyTableExtension extends MyTable\n{\n    fields\n    {\n        field(2; OtherField; Integer)\n        {\n            Access = Public;\n        }\n    }\n}\n```\n## Related information\nAppSourceCop Analyzer<appsourcecop>\nGet Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}