Skip to content

Latest commit

 

History

History
81 lines (66 loc) · 2.26 KB

appsourcecop-as0026.md

File metadata and controls

81 lines (66 loc) · 2.26 KB
title description ms.author ms.date ms.tgt_pltfrm ms.topic author
AppSourceCop Error AS0026
The type and subtype of parameters cannot be modified in events and external procedures.
solsen
02/26/2024
na
reference
SusanneWindfeldPedersen

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 is 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).

See Also

AppSourceCop Analyzer
Get Started with AL
Developing Extensions