Skip to main content

Creating a constant

:::info Status Outline — expand with a full worked example. :::

:::tip Use the shipped skill Prefer the create-constant skill (in your scaffolded repo's .claude/skills/) over hand-rolling this. :::

A Constant is a single scalar configuration value (e.g. DefaultPriceTypeConstant) — simpler than a Dictionary, with no list of rows, just one current value plus history.

What you get

An engine-level admin UI (list/edit/history) covers every Constant generically — you don't build a page per constant. Setting and reading a constant's value goes through typed SetAsync<T>/GetAsync<C> services; keep the stored JSON shape consistent between the two, since a mismatch here is a real bug class (the constants admin UI implementation hit exactly this and fixed a genuine SetAsync<T>/GetAsync<C> JSON-shape bug along the way).

See also

  • Localization and Chart of accounts both use Constants for their own default-value configuration (default price type, default posting accounts).