แก้ไข

แชร์ผ่าน


AppSourceCop Error AS0088

Objects with an ID that can be referenced and which have been published must not be deleted.

Description

Objects that can be referenced by ID and which have been published must not be deleted. This might break the upgrade of existing installations and dependent extensions.

How to fix this diagnostic?

Reverting the change will fix this diagnostic. If deleting the object is required, the recommended approach is to mark it first as ObsoleteState Pending. You can then remove the object in a later version, or mark it as ObsoleteState Removed if the object is a table. You cannot mark a table ObsoleteState = Removed if the table is not ObsoleteState = Pending in the previous version.

Code Examples

Example 1: Deleting a Codeunit triggers the rule

Version 1.0 of the extension:

codeunit 50120 Foo_MyCodeunit
{
    procedure MyProcedure()
    begin
        // Business logic.
    end;
}

In version 2.0 of the extension, codeunit 50120 has been deleted. This will trigger rule AS0088.

Example 2: Deleting an obsolete pending Codeunit

Version 2.0 of the extension:

codeunit 50120 Foo_MyCodeunit
{
    ObsoleteState = Pending;
    ObsoleteReason = 'Use 50121 Foo_MyNewCodeunit instead.';
    procedure MyProcedure()
    begin
        // Business logic.
    end;
}

codeunit 50121 Foo_MyNewCodeunit
{
    procedure SomeProcedure()
    begin
        // Business logic.
    end;
}

In version 3.0 of the extension, codeunit 50120 has been deleted. This is okay, because codeunit 50120 previously had been marked with ObsoleteState = Pending informing developers to use "50121 Foo_MyNewCodeunit" instead.

AppSourceCop Analyzer
Get Started with AL
Developing Extensions