Skip to content

Contexts

A context is a place in which a record’s values can differ. Markets, languages, sales channels, and stores are typical contexts. Contexts form a tree under a root context called default.

Every record can have values in any context. When a context has no value for an attribute, Attricat looks at its parent, then the parent’s parent, up to default, and shows the first value it finds.

default description = "Linen shirt"
└── PL description = "Lniana koszula"
├── PL-web (no value → shows "Lniana koszula")
└── PL-shop description = "Koszula z lnu, krój regularny"

Each attribute can change this:

  • context_fallback: none turns inheritance off. A context without its own value shows nothing. Use it for values that must not spread to children, such as a promotion for one channel.
  • context_editable: default allows the value to be written only in default. Other contexts show it read-only. Use it for global facts, such as a SKU.

Relationship values inherit in the same way.

Open Manage → Contexts and choose Create context.

  • Code: letters, numbers, hyphens, and underscores. The code is how people and integrations refer to the context.
  • Parent context: required; where it sits in the tree. Choose default to make a top-level context.
  • Metadata: an optional JSON object describing the context, for example {"language": "pl"}.

With the CLI:

Terminal window
acli context create --code PL --data '{"language":"pl"}'
acli context create --code PL-web --data '{}' --parent-id <PL-context-id>

The default context always has the ID 00000000-0000-4000-8000-000000000001.

You can move a context to a different parent with acli context update <context-id> --parent-id <parent-id> --data <metadata-json> or the API; the Contexts page only creates and deletes contexts. Before the move is saved, Attricat checks every record against its new inheritance chain. If any record would become invalid, for example by losing a required value, the move is rejected.

A context that still has child contexts, values, or extension runs cannot be deleted, and neither can default.

  • In the Explorer, the Context selector under Search scope shows, filters, and sorts values as they resolve in that context.
  • On a record, the context tabs under Data switch the values you see and edit.
  • In the Explorer’s Browse by panel, relationship links resolve in the context selected in the Explorer.

Inheritance follows the tree, so its shape determines how much you have to type. Put the dimension that shares the most values near the root. A common layout is market, then channel:

default
├── PL
│ ├── PL-web
│ └── PL-marketplace
└── DE
└── DE-web

Contexts are not languages by default. If yours represent locales, record that in their metadata and agree on it as a team. See Model your catalog.

Any context can be enabled as an export channel under Manage → Exports. Records are then published to it separately. See Publishing.

A solution pack can create the contexts and publication channels it needs when you apply it, with codes that start with the pack’s prefix. When you plan the pack, you can instead choose an existing context with --map-context; the pack then uses it as it is and never changes its data, parent, or channel. Contexts created by a pack are ordinary contexts that you can change, move, or delete like any other.

contexts.read is needed to see contexts, and contexts.write to create, change, or delete them and to enable publication channels. A role grant can be limited to a context subtree: it then applies to that context and everything below it, but not to its parent or siblings. Moving a context also needs contexts.write on its new parent.