# AppSourceCop Hidden AS0133
Keys should not be added.
## Description
Keys should not be added.
## Remarks
This rule is not enabled by default since additive changes are generally allowed.
## How to fix this diagnostic?
Revert the changes done by removing the keys that have been added.
## Examples triggering this rule
### Example 1 - Adding a key to a table with schema
Version 1 of the extension
```al
table 50100 MyTable
{
    fields
    {
        field(1; MyField; Integer) { }
        field(2; MyOtherField; Integer) { }
    }
    keys
    {
        key(PK; MyField) { }
    }
}
```
Version 2 of the extension
```al
table 50100 MyTable
{
    fields
    {
        field(1; MyField; Integer) { }
        field(2; MyOtherField; Integer) { }
    }
    keys
    {
        key(PK; MyField) { }
        key(NewKey; MyOtherField) { } // New table key.
    }
}
```
### Example 2 - Adding a key to a table extension with schema
Version 1 of the extension
```al
tableextension 50100 MyExtension extends SomeTable
{
    fields
    {
        field(50100; MyExtField; Integer) { }
        field(50101; MyOtherExtField; Integer) { }
    }
}
```
Version 2 of the extension
```al
tableextension 50100 MyExtension extends SomeTable
{
    fields
    {
        field(50100; MyExtField; Integer) { }
        field(50101; MyOtherExtField; Integer) { }
    }
    keys
    {
        key(NewKey; MyOtherExtField) { } // New table extension key.
    }
}
```
## Example not triggering this rule
### Example - Adding a key to a table without schema
Version 1 of the extension
```al
table 50100 MyTable
{
    TableType = Temporary;

    fields
    {
        field(1; MyField; Integer) { }
        field(2; MyOtherField; Integer) { }
    }
    keys
    {
        key(PK; MyField) { }
    }
}
```
Version 2 of the extension
```al
table 50100 MyTable
{
    TableType = Temporary; // Temporary tables don't contribute to the schema.

    fields
    {
        field(1; MyField; Integer) { }
        field(2; MyOtherField; Integer) { }
    }
    keys
    {
        key(PK; MyField) { }
        key(NewKey; MyOtherField) { } // New table key.
    }
}
```
## Related information
AppSourceCop Analyzer<appsourcecop>
Getting Started with AL<../devenv-get-started>
Developing Extensions<../devenv-dev-overview>

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. https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/appsourcecop-as0133/
