AppSourceCop Error AS0026

The type and subtype of parameters cannot be modified in events and external procedures

Description

The type and subtype of parameters cannot be modified in events and external procedures.

Remarks

It's not allowed to change the type or subtype of parameters in public procedures as this will break dependent extensions which are calling them.

Note

This rule allows to convert Option type parameters into Enum type parameters.

Code examples triggering the rule

Example 1 - Modifying parameters type

Version 1.0 of the extension:

codeunit 50100 MyCodeunit
{
    procedure MyProcedure(i: Integer)
    begin
    end;
}

Version 2.0 of the extension:

codeunit 50100 MyCodeunit
{
    procedure MyProcedure(i: Boolean)
    begin
    end;
}

In version 2.0, the type of the parameter i has changed from Integer to Boolean. If a dependent extension calls this method, this will lead to a compilation error similar to Argument 1: cannot convert from 'Integer' to 'Boolean' (AL0133).

Example 2 - Modifying parameters subtype

Version 1.0 of the extension:

codeunit 50100 MyCodeunit
{
    procedure MyProcedure(i: Record Customer)
    begin
    end;
}

Version 2.0 of the extension:

codeunit 50100 MyCodeunit
{
    procedure MyProcedure(i: Record Vendor)
    begin
    end;
}

In version 2.0, the subtype of the parameter i has changed from a Customer record to a Vendor record. If a dependent extension calls this method, this will lead to a compilation error similar to Argument 1: cannot convert from 'Record Vendor' to 'Record Customer' (AL0133).

AppSourceCop Analyzer
Get Started with AL
Developing Extensions