AL icon indicating copy to clipboard operation
AL copied to clipboard

AS0062 error on Reports with ApplicationArea assigned at the object level

Open salgiza opened this issue 3 years ago • 4 comments

1. Describe the bug AppSourceCop raises errors if you assign the ApplicationArea at the report level and omit it in fields (of the request page).

2. To Reproduce Create a project with AppSourceCop enabled, and assign ApplicationArea to the report, but not to a field. Example:

report 50101 ProcessReport
{
    Caption = 'ReportName';
    UsageCategory = Administration;
    ApplicationArea = All;

    requestpage
    {
        layout
        {
            area(Content)
            {
                group(GroupName)
                {
                    field(TestVariable_field; TestVariable)
                    {
                        Caption = 'Test';
                        ToolTip = 'Tooltip';
                    }
                }
            }
        }
    }

    var
        TestVariable: Text;
}

3. Expected behavior No error should be raised, and the app should compile.

4. Actual behavior The compiler fails with an AS0062 error saying that the control requires an Application Area, but that from runtime 11 (which is selected) it can be specified at the object level instead (which I did).

CleanShot 2023-05-04 at 11 56 23

Sidenote: While this is an example project, in the one I got the error initially I didn't actually remove the Application Areas myself, I used the new code action on it instead.

5. Versions:

  • AL Language: v11.0.787898
  • Visual Studio Code: 1.77.3

salgiza avatar May 04 '23 09:05 salgiza

Getting the same issue

Ugniusig avatar May 19 '23 08:05 Ugniusig

This is probably because we are trying to get the application area from the object in which the field is nested, but the application area is on the ancestor.

BazookaMusic avatar Jun 13 '23 09:06 BazookaMusic

The "Remove redundant application area" code action also affects reports and requestpages, resulting in a build error for hundreds of reports on our end, so it doesn't seem we can use that code action yet. 🫤

bjarkihall avatar Jun 27 '23 10:06 bjarkihall

The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 23.0.11232.0 and VS Code Extension Version 12.0.822204.

If you don’t have access to these images you need to become part of the Ready2Go program: aka.ms/readytogo

For more details on code branches and docker images please read: https://blogs.msdn.microsoft.com/nav/2018/05/03/al-developer-previews-multiple-releases-and-github/ https://freddysblog.com/2020/06/25/working-with-artifacts/

JesperSchulz avatar Jun 28 '23 07:06 JesperSchulz