Repository navigation
knowledge(events): database trigger setup flags may only be set to true - #213
Conversation
Add an events article with compiled good/bad samples: GetDatabaseTableTriggerSetup (Global Triggers) and OnAfterGetDatabaseTableTriggerSetup (GlobalTriggerManagement) share four var Booleans across all subscribers, which run in no particular order. Assigning false, or a lookup result without or-ing in the current value, clears flags other features set (Dataverse sync, API webhooks, data archive, and, for direct Global Triggers subscribers, the change log). Recommends the codeunit 49 integration events per Learn's guidance on system codeunits 2000000001..2000000010 and handler-side table filtering. Wired into al-events-review tokens and an event-design check, with carve-outs for conditional := true, Flag := Flag or ..., and the no-op "if not Flag then Flag := false" found in BCApps. Registered in the events review-fixtures override. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…icle - Name the BCApps code that clears flags (demo data tool W1/CZ/IN, Backup Management test library) as the mechanism in demo/test-only sessions; carve such code out of the al-events-review check. - Label "events are raised only when the flag is true" as inferred and cite the supporting sources (Learn integration-record refactoring on disabled bulk SQL operations, ChangeLog test cache comment, No Transactions Subscriber); fold the bulk-SQL cost into Best Practice. - Drop the "handler without opt-in" signal from article and check. - Qualify change log protection as normal execution context only. - Drop the unverifiable codeunit ID; describe Global Triggers by its 2000000001..2000000010 range and mark the transition page as v14-era. - Order-dependent wording for flag overwrites; add GP and No Transactions as further direct subscribers; link the references. Samples rechecked with alc 30.0 against Base Application 28.4 symbols. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jesper Schulz-Wedde (JesperSchulz)
left a comment
There was a problem hiding this comment.
Reviewed d3aa24d22607bfb26e82069d3aff547e1e966020. The additive setup-flag guidance matches the GlobalTriggerManagement chain: subscribers share the four var Booleans, and codeunit 49 adds change-log flags last only in normal execution context. The rule correctly distinguishes potentially clearing a prior true value from monotone/no-op assignments and explicitly excludes the documented demo/test-session cases. The good handler scopes itself to its own tracked tables. Samples, routing and deterministic positive/clean registration are consistent; exact-head local frontmatter, fixture/contract, skill/schema and knowledge-index/retrieval checks pass. No merge-critical issue found. GitHub's substantive workflows still await approval and should run before merge.
4cd53ea
into
microsoft:main
Summary
events/database-trigger-setup-flags-may-only-be-set-to-true.GetDatabaseTableTriggerSetupon the system codeunitGlobal TriggersandOnAfterGetDatabaseTableTriggerSetupon codeunit 49GlobalTriggerManagementpass the same fourvar Booleanflags through every subscriber, and subscribers run in no particular order. A subscriber that assignsfalse, or a lookup result such asOnDatabaseModify := MySetup.Get(TableId), can clear flags set by Dataverse sync, API webhooks, data archive, or another app. A directGlobal Triggerssubscriber can also clear the change log flags. The compiler does not catch this.GlobalTriggerManagement.Codeunit.allines 51-65: codeunit 49 asks the change log last, and only in the normal execution context (62-64), next to its "don't allow anyone to disable change log" comment. That protects only againstOnAfterGetDatabaseTableTriggerSetupsubscribers.or), API webhooks 224-227, CRM 3748-3753, Master Data Management 1511-1516, Data Archive 27-32, GP migration 11-21. The no-opif not Delete then Delete := false;is carved out.Backup Managementtest library (470-476). They are the same mechanism in demo and test sessions, where clearing is acceptable. The review check carves them out.No Transactions Subscriber, which turns on every flag in order to see every write.al-events-review(tokens plus an event-design check) and registered in the events review-fixtures override.Applicable versions: 15 and later.
Test plan
validate_frontmatter.py: 0 errors (2 warnings, both in files this PR doesn't touch)Test-KnowledgeIndex.ps1,Test-SkillIndex.ps1,Test-KnowledgeRetrieval.ps1,Test-ReviewContract.ps1Test-ReviewFixtures.ps1: 230 cases🤖 Generated with Claude Code