StefanMaron / BusinessCentral.LinterCop

Community driven code linter for AL (MS Dynamics 365 Business Central)
https://stefanmaron.com
MIT License
72 stars 30 forks source link

LC0027: Handle on Variant as Table, with Supported Page #699

Open Arthurvdv opened 1 month ago

Arthurvdv commented 1 month ago

Extend the LC0027 rule to also raise a diagnostic in case when a Variant is passed in combination with a Page which is supported by the Page Management codeunit.

Example

    local procedure HandleError(MyErrorInfo: ErrorInfo)
    var
        RecRelatedVariant: Variant;
    begin
        RecRelatedVariant := MyErrorInfo.RecordId.GetRecord();

        case MyErrorInfo.TableId of
            Database::Resource:
                Page.Run(Page::"Employee Card", RecRelatedVariant);
        end;
    end;