Muokkaa

Jaa


AppSourceCop Warning AS0086

Fields must not increase in length

Description

Increasing the length of a field is not allowed as it might break the runtime behavior of dependent extensions referencing it.

Remarks

The validation of the length of table fields was previously done with AS0004 and has now been split into two different rules:

  • AS0080 - which validates against decreasing the length of fields
  • AS0086 - which validates against increasing the length of fields

How to fix this diagnostic?

Reverting the change will fix this diagnostic. If increasing the length of the field is required, the recommended approach is to mark the field as Obsolete Pending, and in a later app version, remove that state again, and just increase the field length and remove the Obsolete Pending state.

Code example triggering the rule

Version 1.0 of the extension:

table 50100 MyTable
{
    fields
    {
        field(50100; MyField; Text[50]) { }
    }
}

Version 2.0 of the extension:

table 50100 MyTable
{
    fields
    {
        field(50100; MyField; Text[150]) { }
    }
}

In version 2.0, the type of the field MyField has changed from Text[50] to Text[150]. If a dependent extension uses this field, this can lead to runtime exceptions. For instance, if it assigns it to a variable of type Text[50].

AppSourceCop Analyzer
Get Started with AL
Developing Extensions