bcquality/microsoft/knowledge/data-modeling/setup-table-is-a-singleton.bad.al
Jesper Schulz-Wedde 18cb503540 Add data-modeling and appsource knowledge articles (MICROSOFT layer)
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: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-01 11:00:05 +02:00

55 lines
1.3 KiB
AL

table 50366 "Loyalty Setup"
{
Caption = 'Loyalty Setup';
DataClassification = CustomerContent;
fields
{
// Anti-pattern: an autoincrement key lets the table hold many rows,
// so "the setup" is no longer a single, well-known record.
field(1; "Entry No."; Integer)
{
Caption = 'Entry No.';
AutoIncrement = true;
}
field(10; "Member Nos."; Code[20])
{
Caption = 'Member Nos.';
TableRelation = "No. Series";
}
}
keys
{
key(PK; "Entry No.")
{
Clustered = true;
}
}
}
page 50367 "Loyalty Setup List"
{
// Anti-pattern: a List page over a setup table invites multiple rows and
// never guarantees that a row exists to read.
Caption = 'Loyalty Setup List';
PageType = List;
SourceTable = "Loyalty Setup";
UsageCategory = Administration;
ApplicationArea = All;
layout
{
area(Content)
{
repeater(Group)
{
field("Member Nos."; Rec."Member Nos.")
{
ApplicationArea = All;
ToolTip = 'Specifies the number series used to assign member numbers.';
}
}
}
}
}