Skip to content

How to: CoC extension classes

How-to · Core Studio 3.0 · Verified 2026-09-01

Goal: add behavior to a stock method without touching Microsoft’s class — a chain-of-command wrapper that compiles clean on the first build.

Time: ~10 minutes · Requires: a D365 VM for the build step.

Prerequisites

  • A custom model referencing the model that owns the target class (ApplicationSuite for most stock classes — see create & manage a model).
  • The target class and method identified (find-references first if you’re unsure who else wraps it).

Steps

  1. Find the target class in the AOT explorer; right-click it → New X++ Object → class extension.

  2. Review the scaffold — the Studio generates:

    [ExtensionOf(classStr(YourTargetClass))]
    final class YourTargetClass_Extension
    {
    public int totalQty()
    {
    int ret = next totalQty();
    // your behavior here
    return ret;
    }
    }

    The [ExtensionOf(classStr(...))] attribute, the _Extension naming law, and the next-calling stub are all generated — you fill in behavior.

  3. Save (Ctrl+S) — the file lands in <root>/<Model>/<Module>/AxClass/ and re-indexes immediately.

  4. Build the model (Ctrl+B).

Verify it worked

  • First build: 0 errors / 0 warnings with no hand-fix — the wrapper’s shape is compiler-proven.
  • At runtime, your code runs around the stock method (next chains to the rest of the pipeline — Microsoft’s and any other extensions’).

If it goes wrong

  • “Class extension … must be final” — you removed final; the attribute pair is load-bearing, restore the scaffold’s declaration exactly.
  • Your method never fires — signature drift: the wrapper’s signature must match the target method exactly. Re-generate from the scaffold instead of hand-typing.

Next: table extensions · event handlers.