• Skip to main content
  • Skip to primary sidebar
  • Home
  • About
  • Recommended Readings
    • 2022 Book Reading
    • 2023 Recommended Readings
    • Book Reading 2024
    • Book Reading 2025
    • Book Reading 2026
  • Supply Chain Management Guide
  • PKM
  • Microsoft Excel
  • Microsoft Copilot in Office 365
  • Public Wiki Page

Ali Raza Zaidi

A practitioner’s musings on Dynamics 365 Finance and Operations

[Hookable(true)], [Wrappable(false)], and [Replaceable]

November 15, 2026 by alirazazaidi

Today I was searching something and I got very interesting information for X++ So this below post is totally produce from ChatGPT.

In Dynamics 365 Finance & Operations (X++), [Hookable(true)], [Wrappable(false)], and [Replaceable] are method attributes that control how a method can be extended using Chain of Command (CoC) and pre/post event handlers.

1. Attribute comparison

AttributePurposeEffect
[Hookable(true)]Enables pre/post event handlersAllows developers to subscribe to method events
[Wrappable(false)]Disables Chain of CommandPrevents developers from wrapping the method using CoC
[Replaceable]Allows skipping next in CoCEnables a CoC wrapper to replace the original implementation

2. Examples

[Hookable(true)]

Allows pre/post event handlers to be attached to a method.

[Hookable(true)]
public void processOrder()
{
    info("Processing order");
}

A developer can create a pre-handler or post-handler for this method.

Important: Public methods are generally hookable by default, so explicitly specifying [Hookable(true)] is often unnecessary.

[Wrappable(false)]

Prevents developers from extending a method through Chain of Command.

[Wrappable(false)]
public void processOrder()
{
    info("Processing order");
}

The following CoC extension is not allowed:

[ExtensionOf(classStr(MyClass))]
final class MyClass_Extension
{
    public void processOrder()
    {
        next processOrder();
        info("Custom logic");
    }
}

Because the original method has [Wrappable(false)], the compiler rejects the wrapper.

[Replaceable]

Allows a CoC extension to conditionally skip calling next.

[Replaceable]
public boolean validateOrder()
{
    return true;
}

Extension:

[ExtensionOf(classStr(MyClass))]
final class MyClass_Extension
{
    public boolean validateOrder()
    {
        boolean result;

        if (this.isSpecialOrder())
        {
            result = true;
        }
        else
        {
            result = next validateOrder();
        }

        return result;
    }
}

Normally, CoC requires calling next. With [Replaceable], the wrapper can conditionally bypass the original implementation.

3. Can all three attributes be used together?

Consider:

[Hookable(true)]
[Wrappable(false)]
[Replaceable]
public void processOrder()
{
    info("Original implementation");
}

There is a design contradiction here:

  • [Hookable(true)] allows event handlers.
  • [Wrappable(false)] prohibits CoC wrappers.
  • [Replaceable] permits a CoC wrapper to skip next, but wrapping has already been disabled.

Therefore, [Replaceable] provides no practical benefit when [Wrappable(false)] is applied.

4. Recommended usage

RequirementRecommended attribute
Allow pre/post event handlers[Hookable(true)]
Prevent event handlers[Hookable(false)]
Prevent CoC extension[Wrappable(false)]
Allow CoC but require nextDefault CoC behavior
Allow CoC to bypass original logic[Replaceable]
Prevent both CoC and event handlers[Hookable(false)] and [Wrappable(false)]

Architectural recommendation: In D365 F&O, use [Replaceable] carefully because it allows extensions to bypass standard business logic, potentially including validations.

For methods involving inventory posting, financial journals, purchase orders, or other critical transactions, prefer CoC with mandatory next unless there is a specific business requirement to replace standard behavior.

Filed Under: X++ Tagged With: Dynamics 365 for finance and operations, X++

Primary Sidebar

About

I am Dynamics AX/365 Finance and Operations consultant with years of implementation experience. I has helped several businesses implement and succeed with Dynamics AX/365 Finance and Operations. The goal of this website is to share insights, tips, and tricks to help end users and IT professionals.

Legal

Content published on this website are opinions, insights, tips, and tricks we have gained from years of Dynamics consulting and may not represent the opinions or views of any current or past employer. Any changes to an ERP system should be thoroughly tested before implementation.

Categories

  • Accounts Payable (2)
  • Advance Warehouse (2)
  • AI (3)
  • Asset Management (3)
  • Azure Functions (1)
  • Books (6)
  • Certification Guide (3)
  • ChatGPT (3)
  • Claude (1)
  • Customization Tips for D365 for Finance and Operations (65)
  • D365OF (60)
  • Data Management (1)
  • database restore (1)
  • Dynamics 365 (59)
  • Dynamics 365 for finance and operations (140)
  • Dynamics 365 for Operations (176)
  • Dynamics AX (AX 7) (134)
  • Dynamics AX 2012 (274)
  • Dynamics Ax 2012 Forms (13)
  • Dynamics Ax 2012 functional side (16)
  • Dynamics Ax 2012 Reporting SSRS Reports. (31)
  • Dynamics Ax 2012 Technical Side (52)
  • Dynamics Ax 7 (65)
  • ERP implementation (1)
  • Exam MB-330: Microsoft Dynamics 365 Supply Chain Management (7)
  • Excel Addin (1)
  • Favorites (12)
  • Financial Modules (6)
  • Functional (8)
  • General Journal (1)
  • Implementations (1)
  • Ledger (1)
  • Lifecycle Services (2)
  • Logseq (4)
  • Management Reporter (1)
  • Microsoft Excel (4)
  • MS Dynamics Ax 7 (64)
  • MVP summit (1)
  • MVP summit 2016 (1)
  • New Dynamics Ax (19)
  • Non Defined (9)
  • Note taking Apps (2)
  • Obsidian (5)
  • Personal Knowledge Management (3)
  • PKM (17)
  • Postman (1)
  • Power Platform (6)
  • Procurement (5)
  • procurement and sourcing (6)
  • Product Information Management (4)
  • Product Management (6)
  • Production Control D365 for Finance and Operations (10)
  • Project Management (2)
  • Sale Order Process (10)
  • Sale Order Processing (10)
  • Sales and Distribution (5)
  • Soft Skill (1)
  • Supply Chain Management D365 F&O (5)
  • Team Lead tips (1)
  • Team Management (1)
  • Tips and tricks (278)
  • Uncategorized (165)
  • Upgrade (1)
  • Web Cast (7)
  • White papers (4)
  • X++ (15)

Wiki

  • SCM

Copyright © 2026 · Magazine Pro On Genesis Framework · WordPress · Log in