p202 ltv fields create

Define a custom field customers can carry (filter by it with --cf)

New in 1.9.77Writescannot be staged
All commands

01Run it

Straight from the command's own help.

p202 ltv fields create --key plan --type select --option free --option pro
p202 ltv fields create --key score --type number --label "Lead score"

02What you get

Pick the shape you need. People get a table. Add --json, --csv or --ndjson for scripts, or -q for ids only. An AI agent gets compact JSON without asking. All output formats

03Build your command

Pick values and the command line writes itself, quoted and ready to paste.

p202 ltv fields create

Set flags below; the command updates as you type.

04Flags

6 flags, plus the global flags every command takes.

FlagWhat it does
--keystringrequiredThe field's key: 1-64 of a-z, 0-9 and _ (required; fixed once created)
--labelstringDisplay label (default the key)
--optionstringArrayA select field's choice (repeatable; required for --type select)
--requiredboolEvery customer save must carry a value for it
--sort-orderstringPosition among the fields (0 or more; default 0)
--typestringValue type (default text; fixed once created): text, number, date, boolean, select, email, url
textnumberdatebooleanselectemailurl

05How it works

Defines a field: its key (how writes and --cf filters name it), label, type, and for a select field its choices. The key and type cannot change later.

p202 ltv fields create --key plan --type select --option free --option pro
p202 ltv fields create --key score --type number --label "Lead score"

06For agents

Running this from an agent

  • Read the same facts as JSON: p202 commands ltv fields create --json.
  • With AI_AGENT, CLAUDECODE or another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with a hint.
  • Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
  • This command writes and cannot be staged: --staged is refused before anything is sent. Have a person run it, or give the agent a key without write scope.
p202 commands ltv fields create --json
{
  "path": "p202 ltv fields create",
  "use": "create --key <key>",
  "short": "Define a custom field customers can carry (filter by it with --cf)",
  "long": "Defines a field: its key (how writes and --cf filters name it), label, type, and for a select\nfield its choices. The key and type cannot change later.\n\n  p202 ltv fields create --key plan --type select --option free --option pro\n  p202 ltv fields create --key score --type number --label \"Lead score\"",
  "runnable": true,
  "flags": [
    {
      "name": "key",
      "type": "string",
      "default": "",
      "usage": "The field's key: 1-64 of a-z, 0-9 and _ (required; fixed once created)",
      "required": false
    },
    {
      "name": "label",
      "type": "string",
      "default": "",
      "usage": "Display label (default the key)",
      "required": false
    },
    {
      "name": "option",
      "type": "stringArray",
      "default": "[]",
      "usage": "A select field's choice (repeatable; required for --type select)",
      "required": false
    },
    {
      "name": "required",
      "type": "bool",
      "default": "false",
      "usage": "Every customer save must carry a value for it",
      "required": false
    },
    {
      "name": "sort-order",
      "type": "string",
      "default": "",
      "usage": "Position among the fields (0 or more; default 0)",
      "required": false
    },
    {
      "name": "type",
      "type": "string",
      "default": "",
      "usage": "Value type (default text; fixed once created): text, number, date, boolean, select, email, url",
      "allowed_values": [
        "text",
        "number",
        "date",
        "boolean",
        "select",
        "email",
        "url"
      ],
      "required": false
    }
  ]
}