Repository navigation
IsHandled Extensibility Pattern #289
Replies: 3 comments 15 replies
|
Why don't you just ignore the An improvement would be, if Microsoft would trigger an additional event before leaving the base function (whether or not there was a subscriber or the function was left executing base-apps' code). |
|
I fully agree. The |
|
Microsoft’s guidance on the IsHandled pattern makes a similar point: the main concern is that IsHandled can skip large parts of the original code path, meaning events inside that code may not be raised and other extensions can be affected. For new code, positive/regular events are generally a better approach because they add extensibility without skipping existing logic. IsHandled should be kept to cases where there isn't a better option. |
Uh oh!
There was an error while loading. Please reload this page.
Working title: IsHandled Extensibility Pattern
IsHandled Pattern: Missing Extensibility Preservation Rule
Context
The IsHandled pattern is a fundamental extensibility mechanism in Dynamics 365 Business Central.
It is:
This clearly indicates:
Problem Statement
Current guidance around IsHandled focuses on correct usage and avoiding unintended overrides.
However, one critical aspect is missing:
Observation
Across multiple real-world solutions, three recurring patterns appear:
All three share the same root problem:
Root Cause
The IsHandled pattern introduces a hard execution boundary:
When a subscriber sets:
IsHandled := true;it prevents:
Proposal: Extensibility Preservation Rule
New Rule
Correct Implementation Pattern
Original
Improved
Important Constraint
This means:
Relation to Method Pattern
This proposal is inspired by the Method Pattern, but intentionally simplified.
This makes it a transitional pattern.
Why Not Replace IsHandled?
In real systems:
Therefore:
Key Insight
Final Rule
Conclusion
This is not a new pattern.
It is a minimal extraction of principles from the Method Pattern,
applied to the most widely used extensibility mechanism in Business Central.
The goal is simple:
All reactions