From 37583adefd98e8021fb3696b5bd66399e2bab634 Mon Sep 17 00:00:00 2001 From: Arthur van de Vondervoort Date: Wed, 19 Aug 2026 13:12:06 +0200 Subject: [PATCH] docs(AC0032): document RecordRef whole-object bailout Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../docs/analyzers/ApplicationCop/AC0032.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/content/docs/analyzers/ApplicationCop/AC0032.md b/content/docs/analyzers/ApplicationCop/AC0032.md index a06a0d1..8cc3c68 100644 --- a/content/docs/analyzers/ApplicationCop/AC0032.md +++ b/content/docs/analyzers/ApplicationCop/AC0032.md @@ -88,6 +88,28 @@ The diagnostic is suppressed when any of the following conditions apply: - The containing symbol is obsolete - The codeunit is a test codeunit with `TestPermissions = Disabled` - The containing object is a `permissionset` or `permissionsetextension` (these declare permissions structurally, not for access control) +- The object contains a database operation on a `RecordRef` (see below) + +### RecordRef operations + +A `RecordRef` can point to any table, and which table it targets is only known at runtime. When an object contains **any** database operation on a `RecordRef` receiver (`Find`, `FindFirst`, `FindLast`, `FindSet`, `Get`, `GetBySystemId`, `IsEmpty`, `Count`, `Insert`, `Modify`, `ModifyAll`, `Rename`, `Delete`, or `DeleteAll`), the rule cannot determine which declared permission that operation consumes. AC0032 is therefore disabled for the entire object: no unused-permission diagnostics are reported, and the code fix is not offered. + +{{< highlight al >}} +codeunit 50100 "Ledger Entry Management" +{ + // No AC0032 diagnostics: the RecordRef.Modify call below may target any of these tables at runtime + Permissions = + tabledata "G/L Entry" = md, + tabledata "Cust. Ledger Entry" = md; + + procedure DoModify(var RecordRefToModify: RecordRef; RunTrigger: Boolean) + begin + RecordRefToModify.Modify(RunTrigger); + end; +} +{{< /highlight >}} + +Note that this also suppresses genuinely unused entries in the same object. This trade-off is deliberate: a false "unused" report combined with the code fix would remove permissions that are required at runtime. ### Temporary tables