From dfb793fdb870d94d2875575ceee26f07d8f39744 Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Wed, 7 Oct 2026 21:39:14 +0200 Subject: [PATCH] docs(AC0002): document setup-table exemption Co-Authored-By: Claude Opus 5.5 (1M context) --- .../docs/analyzers/ApplicationCop/AC0002.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/content/docs/analyzers/ApplicationCop/AC0002.md b/content/docs/analyzers/ApplicationCop/AC0002.md index c66d6b1..f333073 100644 --- a/content/docs/analyzers/ApplicationCop/AC0002.md +++ b/content/docs/analyzers/ApplicationCop/AC0002.md @@ -68,6 +68,40 @@ table 50100 "Item Category" } {{< /highlight >}} +### Exception + +Setup tables are not reported. A setup table holds a single record, and its primary key is always blank by design. No other table relates to that record, so there is nothing for a rename or delete to cascade to. + +The rule recognises a setup table by convention, not by checking inbound table relations. A table counts as a setup table when either of these is true: + +- its only primary key field is a Code field named `Primary Key` or `PrimaryKey`; +- it declares a parameterless `GetRecordOnce` procedure without a return value. + +{{< highlight al >}} +table 50100 "My Setup" +{ + fields + { + field(1; "Primary Key"; Code[10]) // Not reported: setup table + { + } + field(2; "Default Location Code"; Code[10]) + { + } + } + + keys + { + key(PK; "Primary Key") + { + Clustered = true; + } + } +} +{{< /highlight >}} + +A single-record table that does not follow this convention is still reported. A Text `Primary Key` field is one example. A key field named `PK` or `Code` without a `GetRecordOnce` procedure is another. Set `NotBlank = false` explicitly on such a field to record that the blank key is intended. + ### See also - [NotBlank Property](https://learn.microsoft.com/dynamics365/business-central/dev-itpro/developer/properties/devenv-notblank-property) on Microsoft Learn