MB-500 · Question #156
Drag and Drop Question You are creating a new class and adding methods to the class. You need to control extensibility capabilities of some of the methods in the class. Which attribute should you…
The correct answer is [Hookable(true)]; [Wrappable(false)]; [Replaceable]. X++ Method Extensibility Attributes (D365 F&O) This question is from Microsoft Dynamics 365 Finance & Operations X++ development (likely MB-500 or D365 developer certification). It tests knowledge of how to control how ISVs or partners can extend your class methods. --- The…
Question
Exhibit
Answer Area
Drag items
Correct arrangement
- [Hookable(true)]
- [Wrappable(false)]
- [Replaceable]
Explanation
X++ Method Extensibility Attributes (D365 F&O)
This question is from Microsoft Dynamics 365 Finance & Operations X++ development (likely MB-500 or D365 developer certification). It tests knowledge of how to control how ISVs or partners can extend your class methods.
The Three Requirements (Inferred from Correct Answers)
The question maps attributes to requirements like these:
| # | Requirement | Correct Attribute |
|---|---|---|
| 1 | Allow event handlers (pre/post) to subscribe to this method | [Hookable(true)] |
| 2 | Prevent this method from being wrapped via Chain of Command | [Wrappable(false)] |
| 3 | Allow this method to be completely replaced by an extension | [Replaceable] |
Placement Explanations
1. [Hookable(true)] - Enables event subscriptions
- Marks the method as hookable, meaning other code can attach
pre-andpost-event handlers without modifying the original method. - This is actually the default for most methods, but explicitly declaring it communicates intent and ensures it survives refactoring.
- Use when you want to allow lightweight extension without giving up control of the method body.
2. [Wrappable(false)] - Blocks Chain of Command (CoC)
- Chain of Command is the primary extension mechanism in D365 - it lets extension classes call
next methodName()and wrap execution before/after. [Wrappable(false)]locks the method against CoC, preventing extensions from injecting code around it.- Use when the method has sensitive logic that must not be intercepted mid-execution.
3. [Replaceable] - Allows full method replacement
- Permits an extension class to completely substitute the method body.
- This is the most permissive extensibility option - the original implementation can be discarded entirely.
- Use intentionally: it gives extensions maximum power but makes your original logic optional.
Why [Hookable(false)] is the Unused Distractor
[Hookable(false)] disables event subscriptions - the opposite of requirement 1. It's there to test whether you confuse "allow hooking" vs. "prevent hooking." A common mistake is mixing up true/false variants and assuming [Hookable] alone always enables extension.
Key Misconceptions to Avoid
[Hookable]and[Wrappable]are independent. A method can be hookable but not wrappable, or vice versa.[Replaceable]does not imply hookable or wrappable. Each attribute controls a distinct extensibility channel.- Default behavior matters: Methods are hookable and wrappable by default - you only need these attributes when changing from the default.
Topics
Community Discussion
No community discussion yet for this question.
