bcquality/microsoft/knowledge/error-handling/page-boolean-triggers-default-to-true.md
wenjiefan 9cc5627f42 Move false-positive guards from skills into knowledge files
Keep review skills slim (finders/appliers). The FP guards and released-baseline preconditions previously embedded in leaf skills become negative-clarification knowledge articles in their domains, and the agent-findings policy edits to al-ui/al-privacy are reverted to main. Adds 6 knowledge files: error-handling (page-boolean-triggers-default-to-true), ui (bound-page-field-inherits-source-field-tooltip), performance (calcfields-in-both-getrecord-triggers-is-not-redundant, page-effective-filter-may-live-outside-the-diff), breaking-changes (unreleased-symbol-change-is-not-a-breaking-change), upgrade (unreleased-schema-change-needs-no-upgrade-path).
2026-07-17 09:58:16 +02:00

1.6 KiB

bc-version domain keywords technologies countries application-area
all
error-handling
oninsertrecord
onmodifyrecord
ondeleterecord
onquerypage
boolean-trigger
exit
false-positive
al
w1
all

Page record triggers return true by default; a missing exit(true) does not block the operation

Description

The Boolean page record triggers OnInsertRecord, OnModifyRecord, OnDeleteRecord, and OnQueryClosePage return true by default. When the trigger body omits an explicit return value, the platform treats the result as true and the operation proceeds. Only an explicit exit(false) — or a reachable code path that returns false — cancels the insert, modify, delete, or page close.

This is a defined exception to the ordinary Boolean method rule, where the default return is false. Reviewers unfamiliar with the exception sometimes read a page record trigger that has no exit(true) and conclude the operation is blocked; it is not.

Best Practice

Do not claim that a missing exit(true) blocks or prevents an insert, modify, or delete, and do not recommend adding exit(true) "to let the operation proceed" — that is already the default. Evaluate these triggers only for an explicit or reachable exit(false)/false-returning path that would cancel the operation unintentionally.

Anti Pattern

Flagging OnInsertRecord, OnModifyRecord, OnDeleteRecord, or OnQueryClosePage as defective because it "does not return true", or asserting that inserts/modifies/deletes will silently fail without an explicit exit(true). The default return already permits the operation.