6 min readRishi

Feature Management in D365 Finance and Operations: Flags, States, and Custom Features

Feature Management in D365 Finance and Operations: Flags, States, and Custom Features

Every Dynamics 365 Finance and Operations release wave lands with dozens of features that are off by default, on by default, or on their way to becoming mandatory. The Feature management workspace is where that lifecycle plays out, and treating it as a checkbox screen instead of part of your ALM process is how environments drift apart and how a mandatory feature surprises you in production on upgrade weekend.

The workspace is a state machine

Every feature moves through a lifecycle Microsoft controls. A feature ships as preview, becomes generally available but optional, then on by default, and eventually mandatory — at which point the toggle disappears and the behavior simply is. The workspace shows where each feature sits, when it was added, and which module it affects.

StateWho decidesWhat it means for you
PreviewYou opt inEvaluate in sandbox only
Optional, off by defaultYouEnable deliberately, test first
On by defaultMicrosoft, you can disableTest now; disabling is temporary
MandatoryMicrosoftNo toggle; behavior is permanent

"On by default" is a deadline, not a suggestion. Release notes usually name the version where it becomes mandatory. Regression-test while you can still turn it off. Build a recurring review of newly added features into your release cadence — the workspace supports marking new features as reviewed.

Mandatory is the date on the calendar. If a warehouse feature becomes mandatory in the next wave and your integration still assumes the old export shape, the upgrade will not ask permission. Read that line while the feature is optional. A disable in production is a stopgap, not a plan.

Feature state lives in the database

Enabling a feature writes to the database, not to code. A deployable package does not carry feature states. Matching X++ does not mean matching flags.

A database refresh from production overwrites sandbox feature states with whatever production had. Preview features you enabled only in sandbox turn off. Production flags you were not ready to test land in the sandbox as enabled. That is why the rebate engine "vanishes" the morning after a refresh.

Practical consequences:

  1. Keep a tracked list of intentionally enabled features per environment, in source control or your ALM tool. Production is one list. Sandbox is another. The delta is the post-refresh work.
  2. After every database refresh from production, re-apply sandbox-only feature enablement as a scripted post-refresh step. Do not rely on someone remembering which preview they clicked last month.
  3. Enable in sandbox, test, then enable in production as a change-managed action with a named owner. The workspace click is the release, not the package deploy.
  4. Features that cannot be disabled once enabled are called out in the workspace — read that flag before clicking. There is no "undo deploy" for those.

Some features reach across modules. A finance feature can change posting an integration depends on; a warehouse feature can alter what a data entity exports. Treat enablement like a code deployment.

Two sandboxes built from the same package, enabled by two people, will also diverge. The tracked list is what you intended. The workspace is what the kernel will do.

Register your own flag

Custom X++ code can register in the same workspace. Implementing IFeatureMetadata gives your feature a name, description, module, and enablement behavior, and it shows up in Feature management next to Microsoft's own. This is the supported way to ship risky changes dark and enable them per environment.

public final class MyRebateEngineFeature implements IFeatureMetadata
{
    public FeatureModuleV0 module()
    {
        return FeatureModuleV0::AccountsReceivable;
    }

    public str label()
    {
        return "New rebate calculation engine";
    }

    public str summary()
    {
        return "Replaces the legacy rebate calculation with the rules-based engine.";
    }

    public boolean isEnabledByDefault()
    {
        return false;
    }

    public boolean canDisable()
    {
        return true;
    }
}

isEnabledByDefault should stay false until new environments should pick the path up automatically. canDisable should stay true until you have removed the legacy branch.

Guard the code path with a runtime check:

if (FeatureStateProvider::isFeatureEnabled(MyRebateEngineFeature::instance()))
{
    this.calculateWithRulesEngine();
}
else
{
    this.calculateLegacy();
}

Keep both paths alive until the flag is removed. A flag whose legacy branch no longer compiles is a lie in the workspace. Plan removal as a backlog item once the feature has soaked in production. Check the flag at the decision point, not once at main threaded through ten classes.

Do not flag a trivial change

A feature flag is a second product you will operate: two code paths, a workspace entry, an enablement record in every environment, and a removal task you will postpone. Use that cost on work that is risky, reversible, or must turn on at a different moment than the deploy.

Do not put a flag around:

  • A label, a help text, or a form field move that you will never turn off.
  • A bug fix that must be on everywhere the package lands. If the old path is wrong, delete it. A flag that exists so you can "roll back the fix" is a way to keep the bug.
  • A one-line guard that is cheaper to feature-toggle in configuration you already have — a parameter on your own table, a document type — when you do not need the workspace lifecycle.

Do flag a new posting path, a replaced calculation, or anything that must sit dark in production through a weekend. That is the same split as deployment versus release.

Deploy dark, enable later

The payoff is releasing on your schedule, not the package's. With the engine above, you can deploy the package during a normal service window, verify it dark, and enable the feature Monday morning with the business on standby — and disable it in seconds if the first rebate run looks wrong, instead of rolling back a deployment.

The enablement is the change record. The package can go out on Thursday. The flag can wait until the batch that exercises it is watched.

The same discipline on Microsoft's features — review on cadence, test while optional, enable as a managed change — stops upgrade-weekend surprises.

After the next refresh

  • Export or record production feature states before you copy the database down.
  • After the refresh, compare the sandbox workspace to the sandbox list. Re-enable preview and sandbox-only flags the refresh wiped.
  • Confirm production-only flags that came down with the copy are flags you actually want to test. Disable the ones that would hide a sandbox scenario.
  • For your own IFeatureMetadata flags, confirm FeatureStateProvider::isFeatureEnabled matches the workspace after the copy. A new class in an old database is off until someone enables it here.

Skip the review and the next mandatory feature will introduce itself during the upgrade. Treat the click as a release. Keep the list next to the package.

Keep reading

Newsletter

New posts, straight to your inbox

One email when a new post goes up. Double opt-in, unsubscribe anytime. Not a daily digest.

Comments

  • No comments yet. Be the first.