knowledge(events): database trigger setup flags may only be set to true - #213
Open
Michael Dieringer (MichaelDieringer) wants to merge 2 commits into
Open
Michael Dieringer (MichaelDieringer) wants to merge 2 commits into
Michael Dieringer (MichaelDieringer) wants to merge 2 commits into
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 <[email protected]>
…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 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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