{"title":"AppSourceCop Hidden AS0133","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/appsourcecop-as0133/","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-as0133, 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-as0133","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":"Keys should not be added.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"AppSourceCop Hidden AS0133","slug":"appsourcecop-hidden-as0133","at":0,"chars":2276},{"level":2,"title":"Description","slug":"description","at":55,"chars":41},{"level":2,"title":"Remarks","slug":"remarks","at":96,"chars":93},{"level":2,"title":"How to fix this diagnostic?","slug":"how-to-fix-this-diagnostic","at":189,"chars":98},{"level":2,"title":"Examples triggering this rule","slug":"examples-triggering-this-rule","at":287,"chars":1151},{"level":3,"title":"Example 1 - Adding a key to a table with schema","slug":"example-1---adding-a-key-to-a-table-with-schema","at":320,"chars":542},{"level":3,"title":"Example 2 - Adding a key to a table extension with schema","slug":"example-2---adding-a-key-to-a-table-extension-with-schema","at":862,"chars":576},{"level":2,"title":"Example not triggering this rule","slug":"example-not-triggering-this-rule","at":1438,"chars":687},{"level":3,"title":"Example - Adding a key to a table without schema","slug":"example---adding-a-key-to-a-table-without-schema","at":1474,"chars":651},{"level":2,"title":"Related information","slug":"related-information","at":2125,"chars":151}],"text":"# AppSourceCop Hidden AS0133\nKeys should not be added.\n## Description\nKeys should not be added.\n## Remarks\nThis rule is not enabled by default since additive changes are generally allowed.\n## How to fix this diagnostic?\nRevert the changes done by removing the keys that have been added.\n## Examples triggering this rule\n### Example 1 - Adding a key to a table with schema\nVersion 1 of the extension\n```al\ntable 50100 MyTable\n{\n    fields\n    {\n        field(1; MyField; Integer) { }\n        field(2; MyOtherField; Integer) { }\n    }\n    keys\n    {\n        key(PK; MyField) { }\n    }\n}\n```\nVersion 2 of the extension\n```al\ntable 50100 MyTable\n{\n    fields\n    {\n        field(1; MyField; Integer) { }\n        field(2; MyOtherField; Integer) { }\n    }\n    keys\n    {\n        key(PK; MyField) { }\n        key(NewKey; MyOtherField) { } // New table key.\n    }\n}\n```\n### Example 2 - Adding a key to a table extension with schema\nVersion 1 of the extension\n```al\ntableextension 50100 MyExtension extends SomeTable\n{\n    fields\n    {\n        field(50100; MyExtField; Integer) { }\n        field(50101; MyOtherExtField; Integer) { }\n    }\n}\n```\nVersion 2 of the extension\n```al\ntableextension 50100 MyExtension extends SomeTable\n{\n    fields\n    {\n        field(50100; MyExtField; Integer) { }\n        field(50101; MyOtherExtField; Integer) { }\n    }\n    keys\n    {\n        key(NewKey; MyOtherExtField) { } // New table extension key.\n    }\n}\n```\n## Example not triggering this rule\n### Example - Adding a key to a table without schema\nVersion 1 of the extension\n```al\ntable 50100 MyTable\n{\n    TableType = Temporary;\n\n    fields\n    {\n        field(1; MyField; Integer) { }\n        field(2; MyOtherField; Integer) { }\n    }\n    keys\n    {\n        key(PK; MyField) { }\n    }\n}\n```\nVersion 2 of the extension\n```al\ntable 50100 MyTable\n{\n    TableType = Temporary; // Temporary tables don't contribute to the schema.\n\n    fields\n    {\n        field(1; MyField; Integer) { }\n        field(2; MyOtherField; Integer) { }\n    }\n    keys\n    {\n        key(PK; MyField) { }\n        key(NewKey; MyOtherField) { } // New table key.\n    }\n}\n```\n## Related information\nAppSourceCop Analyzer<appsourcecop>\nGetting Started with AL<../devenv-get-started>\nDeveloping Extensions<../devenv-dev-overview>"}