AL icon indicating copy to clipboard operation
AL copied to clipboard

Page Field Property ShowMandatory expression errors when using global variable

Open Ugniusig opened this issue 4 years ago • 3 comments

1. Describe the bug Page field property ShowMandatory errors when adding a condition when a global variable is used.

2. To Reproduce Create a page and a global variable field with ShowMandatory property, use the SourceTable Field condition and run the page. The error should appear: "The identifier 'SourceTableFieldName' could not be found.".

Page 50000 "errtest"
{
    ApplicationArea = All;
    Caption = 'errtest';
    PageType = Card;
    SourceTable = Customer;

    layout
    {
        area(content)
        {
            group(General)
            {
                field(Address; AddressText)
                {
                    ShowMandatory = Rec."Copy Sell-to Addr. to Qte From" = Rec."Copy Sell-to Addr. to Qte From"::Company;
                    Caption = 'Address';
                    ToolTip = 'Specifies the customer''s address. This address will appear on all sales documents for the customer.';
                }
            }
        }
    }

    var
        AddressText: Text[100];
}

3. Expected behavior The error should not be shown as the ShowMandatory property can be specified as an expression. If it's not supported to be working on global variables then the AL Extension compiler error should be shown.

4. Actual behavior image

5. Versions:

  • AL Language: 10.1.707468
  • Visual Studio Code: 1.73.1
  • Business Central: 21 (2022 Wave 2)

Ugniusig avatar Nov 21 '22 08:11 Ugniusig

Using Rec. in properties has historically been so broken that at this point we have to consciously remember to avoid it. Even the stuff that does work on modern BC breaks horribly on e.g. BC15.0 - and MS don't seem to care that if we are targeting a runtime where these things didn't work, we should get a build-time error. :-(

dzzzb avatar Nov 21 '22 11:11 dzzzb

I agree with you @dnpb and in my mind, I have a trigger to avoid it, but sometimes when refactoring old code this is overlooked and triggers a whole page open issue. Something should be done :)

Ugniusig avatar Nov 21 '22 11:11 Ugniusig

Hi! Let's get the issue to a team who will fix and backport it, as this repository is only for issues related to the AL compiler and developer tools of the latest developer preview environment for Dynamics 365 Business Central. We suggest that you open a support case to ensure that all Business Central users benefit from your catch as soon as possible.

To open a support case, you can:

  • Open a support request to CSS through the PartnerSource portal

  • Contact your Service Account Manager (SAM) in your local subsidiary to understand what is included in your contract as of support incident and PAH (Partner Advisory Hours). Your SAM might also direct you "step by step" how to open a support request or how to get credentials, if this is the first time for you or your company

The fix for this has to be done on the client-side evaluation of the property.

thloke avatar Dec 01 '22 09:12 thloke