mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 09:26:52 +01:00
Author 7 remedial BCQuality knowledge articles plus good/bad AL samples (21 files) covering AL master-table and data-model design: - data-modeling: master No. from number series in OnInsert; use codeunit "No. Series" not obsolete NoSeriesManagement; setup table is a singleton; set Last Date Modified in OnModify and OnRename; enforce Blocked in referencing code not in the master. - style: ApplicationArea required on page controls (AS0062). - appsource: object affixes prevent collisions (AS0011). Clean-room authored from own BC knowledge; specifics verified against public sources only (learn.microsoft.com, microsoft/BCApps). Introduces two new domains (data-modeling, appsource). Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
51 lines
1.3 KiB
AL
51 lines
1.3 KiB
AL
table 50363 "Loyalty Member"
|
|
{
|
|
Caption = 'Loyalty Member';
|
|
DataClassification = CustomerContent;
|
|
|
|
fields
|
|
{
|
|
field(1; "No."; Code[20])
|
|
{
|
|
Caption = 'No.';
|
|
|
|
trigger OnValidate()
|
|
begin
|
|
if "No." = xRec."No." then
|
|
exit;
|
|
LoyaltySetup.Get();
|
|
// Obsolete-pending: NoSeriesManagement.TestManual raises a
|
|
// deprecation warning and is scheduled for removal.
|
|
NoSeriesMgt.TestManual(LoyaltySetup."Member Nos.");
|
|
"No. Series" := '';
|
|
end;
|
|
}
|
|
field(2; "No. Series"; Code[20])
|
|
{
|
|
Caption = 'No. Series';
|
|
Editable = false;
|
|
}
|
|
}
|
|
|
|
keys
|
|
{
|
|
key(PK; "No.")
|
|
{
|
|
Clustered = true;
|
|
}
|
|
}
|
|
|
|
var
|
|
LoyaltySetup: Record "Loyalty Setup";
|
|
NoSeriesMgt: Codeunit NoSeriesManagement;
|
|
|
|
trigger OnInsert()
|
|
begin
|
|
if "No." = '' then begin
|
|
LoyaltySetup.Get();
|
|
LoyaltySetup.TestField("Member Nos.");
|
|
// Obsolete-pending legacy assignment call; use codeunit "No. Series".
|
|
NoSeriesMgt.InitSeries(LoyaltySetup."Member Nos.", xRec."No. Series", 0D, "No.", "No. Series");
|
|
end;
|
|
end;
|
|
}
|