AppSourceCop Error AS0029

Pages and PageExtensions that have been published must not be deleted, since dependent extensions may break

Description

Pages and PageExtensions that have been published must not be deleted.

Remarks

It is not allowed to remove pages which have been published. This will break dependent extensions which:

  • are referencing this page from code,
  • are extending the page using a page extension,
  • are customizing the page using page customizations.

How to fix this diagnostic?

Revert the change by adding the page back and marking it as Obsolete. Marking a page extension as obsolete is not currently supported, which means that undoing the deletion at this point is the only available fix.

Examples of errors for dependent extensions

The following examples show some of the compilation errors that will be reported on dependent extensions if a page is removed from one version to another.

Version 1.0 of the extension defines a page named MyPage. Version 2.0 does not define this page anymore.

Example 1 - Extensions referencing this page using a variable

If a dependent extension references this page from code, when compiling against version 2.0, this will lead to a compilation error similar to Page 'MyPage' is missing (AL0185).

codeunit 50100 SomeCodeunit
{
    procedure SomeProcedure()
    var
        p: Page MyPage;
    begin
    end;
}

Example 2 - Extensions running this page from code

If a dependent extension runs this page from code, when compiling against version 2.0, this will lead to a compilation error similar to 'Page' does not contain a definition for 'MyPage' (AL0132).

codeunit 50100 SomeCodeunit
{
    procedure SomeProcedure()
    begin
        Page.Run(Page::MyPage);
    end;
}

Example 3 - Extensions running this page from an action

If a dependent extension references this page from an action, when compiling against version 2.0, this will lead to a compilation error similar to Page 'MyPage' is missing (AL0185).

    action(ActionName)
    {
        RunObject = page MyPage;
    }

Example 4 - Extensions extending or customizing this page

If a dependent extension extends or customizes this page, when compiling against version 2.0, this will lead to a compilation error similar to The target Page MyPage for the extension object is not found (AL0247).

pageextension 50100 MyExtension extends MyPage
{
    // Some additional changes on the page.
}

See Also

AppSourceCop Analyzer
Get Started with AL
Developing Extensions