Sanity Library Reference Docs
    Preparing search index...
    ContextEntry:
        | { _key: string; _type: "context.string"; name: string; value: string }
        | { _key: string; _type: "context.number"; name: string; value: number }
        | { _key: string; _type: "context.boolean"; name: string; value: boolean }
        | {
            _key: string;
            _type: "context.ref";
            name: string;
            value: GlobalDocumentReference;
        }
        | { _key: string; _type: "context.json"; name: string; value: string }

    One entry of the instance's context bag, rendered to conditions as $context.<name>. Written exactly twice, both at start: the startInstance seed and a parent's spawn.context handoff. Never mutated afterwards — completed effects' outputs live on effectHistory[].outputs and render as $effects, a separate bag.

    Critical: context is NOT a workflow field container. Transition triggers must NOT read it as fields. The workflow's fields live on fields[]; external state lives in the lake (queryable via conditions).

    Type declaration

    • { _key: string; _type: "context.string"; name: string; value: string }
    • { _key: string; _type: "context.number"; name: string; value: number }
    • { _key: string; _type: "context.boolean"; name: string; value: boolean }
    • {
          _key: string;
          _type: "context.ref";
          name: string;
          value: GlobalDocumentReference;
      }
    • { _key: string; _type: "context.json"; name: string; value: string }