Edit

Share via


AppSourceCop Hidden AS0138

Table fields should use the AllowInCustomizations property

Description

Table fields should use the AllowInCustomizations property and its value must be different from ToBeClassified and Always. From runtime 16.0, you can specify on the application object level the AllowInCustomizations to use as default for all its fields.

How to fix this diagnostic?

To resolve this diagnostic, specify the AllowInCustomizations property on either the field level, the table level, or table extension level, and ensure that the value is not set to ToBeClassified or Always. Learn more in AllowInCustomizations.

Code examples triggering the rule

Example 1 - AllowInCustommizations not specified

The AllowInCustomizations property is missing on the field, which triggers the rule:

table 50100 MyTable
{
    fields
    {
        field(1; MyField; Integer) { }
    }
}

Example 2 - AllowInCustommizations set to disallowed value

The AllowInCustomizations property is set to ToBeClassified, which triggers the rule:

table 50100 MyTable
{
    fields
    {
        field(1; MyField; Integer)
        {
            AllowInCustomizations = ToBeClassified; // Not allowed.
        }
    }
}

Code examples not triggering the rule

Example 1 - AllowInCustomizations specified on field level

Here, the field explicitly specifies AllowInCustomizations = AsReadOnly;, which is valid:

table 50100 MyTable
{
    fields
    {
        field(1; MyField; Integer)
        {
            AllowInCustomizations = AsReadOnly;
        }
    }
}

Example 2 - AllowInCustomizations specified on table level

Here, the table sets the property, which applies to all fields by default:

table 50100 MyTable
{
    AllowInCustomizations = AsReadWrite;

    fields
    {
        field(1; MyField; Integer) { }
        field(2; MyOtherField; Integer) { }
    }
}

Example 3 - AllowInCustomizations specified on table extension level

Here, the table extension sets the property, which applies to all fields within this object:

tableextension 50100 MyTableExt extends Customer
{
    AllowInCustomizations = AsReadWrite;

    fields
    {
        field(50100; MyExtField; Integer) { }
        field(50101; MyOtherExtField; Integer) { }
    }
}

AppSourceCop analyzer
Getting started with AL
Developing extensions