---
id: SCR-COM-CAT-020
title: Code editor
route: '/console/{workspace}/configuration/orders/promotions/{id}/codes/new and /codes/{codeId}/edit'
surface: console
product_area: commerce
module: catalog
revision: 1
status: draft
design_intent: proposed
implementation_evidence: observed
inference: []
source_sha:
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
purpose: Prepare or change a code and its permitted claimants.
supports:
  - JNY-COM-CAT-004
  - CAP-COM-CAT-015
permission: commerce.promotions.manage
entry_from:
  - SCR-COM-CAT-018
  - SCR-COM-CAT-021
exits_to:
  - SCR-COM-CAT-021
displays:
  - field: >-
      code, name, single or multi use, limits, window, owner, restricted contacts and organizations,
      eligibility rule, notes
    source: getPromotionCode
actions:
  - label: Save
    operation_id: createPromotionCode
    permission: commerce.promotions.manage
    confirm: false
  - label: Save Changes
    operation_id: updatePromotionCode
    permission: commerce.promotions.manage
    confirm: false
states:
  - loading
  - error
validation:
  - BR-CAP-COM-CAT-015-01
  - BR-CAP-COM-CAT-015-02
  - BR-CAP-COM-CAT-015-03
  - BR-CAP-COM-CAT-015-04
  - BR-CAP-COM-CAT-015-06
  - BR-CAP-COM-CAT-015-07
  - BR-CAP-COM-CAT-015-08
patterns:
  - Standard layout
  - PageHeader
  - RecordPicker
  - EligibilityCard
  - EditorActionBar
component: components/commerce/promotions/code-editor.tsx
evidence:
  - >-
    react-console at baf6dae3: components/commerce/promotions/*.tsx; lib/commerce/promotions/live.ts,
    rules.ts; e2e/mock/promotions.mock.spec.ts.
controls: [TC-IAM-001, TC-IAM-002, TC-IAM-004, TC-IAM-005, TC-AZ-001, TC-AZ-002, TC-AZ-003, TC-AZ-004, TC-AZ-006, TC-TEN-001, TC-TEN-002, TC-TEN-003, TC-CRY-001, TC-LOG-004, TC-PI-001, TC-PI-003]
---

# Code editor

## What the Screen Is For

Prepare or change a code and its permitted claimants.

## What It Shows and Lets People Do

The form configures people or organization restrictions, listing owner, limits, dates, notes and eligibility. RecordPicker selects referenced records and the live adapter uses the service-compatible code form.

## States and Errors

The service rejects taken identities, invalid characters, parent-exceeding dates and reduced limits. The older draft normalizer differs from the live service form, so the live save path must be distinguished from legacy helpers.

## Patterns It Must Respect

Standard layout uses labelled form controls, RecordPicker, EligibilityCard and EditorActionBar.
