Open MercatoDocsSearch docsAPI reference

User guide

Manage dictionaries

Use a dictionary when operators should choose from a shared list of terms. Populate its entries in the right tenant, then reference the dictionary from the custom field.

Dictionaries centralize the enums you reuse across teams – think lifecycle stages, contact sources, or address types. Each tenant can curate its own values, and the UI, APIs, and custom fields stay in sync automatically.

Dictionary overview screen

1. Create a dictionary

Need to seed dictionaries in code? Export them from a module command – for example packages/core/src/modules/customers/commands/people.ts shows how to batch-create entries – or wire them into your deployment scripts.

2. Add tenant-specific entries

Each dictionary stores values per organization and tenant. To populate them:

  1. Select the dictionary from the grid.
  2. Use Add entry to define the human-readable value plus optional metadata.
  3. Mark favorites or defaults if your workflow needs a pre-selected option.

Editing dictionary entries

Entries can be imported via API as well – see /api/dictionaries/{id}/entries.

3. Plug dictionaries into custom fields

Custom fields can draw options from any dictionary, ensuring both CRUD forms and APIs reuse the same value list.

Configuring a dictionary-backed custom field

Prefer defining fields in code? Use the DSL helper:

import { defineFields, cf, entityId } from '@open-mercato/modules/dsl';

export const entities = [
  defineFields(
    entityId('auth', 'user'),
    [
      cf.dictionary('lifecycle_stage', 'customers:lifecycle-stages', {
        label: 'Lifecycle stage',
        formEditable: true,
        filterable: true,
      }),
    ],
    'compliance'
  ),
];

Replace 'customers:lifecycle-stages' with the <module>:<dictionary> identifier you maintain. Inline creation is enabled by default in code; pass { dictionaryInlineCreate: false } to lock the list down.

4. Surface values in the admin UI and APIs

Customer profile showing dictionary-driven fields

With dictionaries plus custom fields, each tenant curates its own controlled vocabularies while sharing a single module codebase.

Previous: People workspace · Next: Encryption setup