Sanity Library Reference Docs
    Preparing search index...

    Binds one Studio document type to one deployed definition. A row replaces the discovered binding for its (docType, definition) pair or adds that pair when discovery found none. Multiple definitions may share a document type; duplicate pairs throw during plugin configuration.

    interface WorkflowMapping {
        autoStart?: boolean;
        contextBuilder?: (subjectGdr: GlobalDocumentReference) => StartContext;
        definition: string;
        docType: string;
        initialStateBuilder?: (
            subjectGdr: GlobalDocumentReference,
        ) => InitialFieldValue[];
        label: string;
        perspectiveField?: { name: string; required?: boolean };
    }
    Index

    Properties

    autoStart?: boolean

    Start this workflow when a fresh document of docType is created in Studio. Defaults to false; existing documents and writes outside Studio do not trigger it. Requires an input-sourced document subject.

    contextBuilder?: (subjectGdr: GlobalDocumentReference) => StartContext

    Initial $context for a manual start. Not used by autoStart.

    definition: string

    The definition name the engine deployed under.

    docType: string

    Studio schema type.

    initialStateBuilder?: (
        subjectGdr: GlobalDocumentReference,
    ) => InitialFieldValue[]

    Initial workflow field entries for a manual start. Replaces the default subject seed; returning [] omits that seed. Not used by autoStart.

    label: string

    Menu and dialog label. Discovered rows use the definition's title, falling back to its name.

    perspectiveField?: { name: string; required?: boolean }

    When set, the Start action reads Studio's usePerspective() to pull the active release. If a release is selected, the named release.ref field entry is seeded with the release's system-document GDR plus its bare releaseName, and the engine derives the instance's perspective from it — so editors can pick a release in the Studio header and start the workflow against it.

    Type declaration

    • Readonlyname: string

      Field entry name on the workflow definition (e.g. "release").

    • Optional Readonlyrequired?: boolean

      If true, the Start action stays disabled until a release is selected in Studio's perspective. If false (default), the action runs without perspective and the workflow uses its defaults.