Reference MetaType Schema - osama1998H/Moca GitHub Wiki

MetaType Schema Reference

Complete JSON schema reference for MetaType definitions.

Top-Level Properties

Property Type Required Description
name string Yes Unique DocType name (PascalCase)
module string Yes Module this DocType belongs to
naming string No Naming strategy (default: autoincrement)
fields array Yes List of field definitions
permissions array No Permission rules
workflow object No Workflow definition for this DocType
is_submittable bool No Enable Submit/Cancel workflow
is_single bool No Singleton document (settings)
is_child_table bool No Used as child table only
is_tree bool No Hierarchical document (parent_name)
title_field string No Field to use as display title
search_fields string No Comma-separated fields for search
default_sort_field string No Default sort field
default_sort_order string No ASC or DESC
description string No DocType description

Field Definition Properties

Property Type Required Description
fieldname string Yes Column name (snake_case)
fieldtype string Yes One of 35 field types
label string No Display label
reqd int No Required (1=yes, 0=no)
unique int No Unique constraint
default any No Default value
options string No Type-specific options (Link target, Select values, etc.)
hidden int No Hidden from UI
read_only int No Non-editable in UI
in_list_view int No Show in list view
in_standard_filter int No Show in filter sidebar
bold int No Bold in list view
depends_on string No JS expression for conditional visibility
mandatory_depends_on string No JS expression for conditional required
description string No Help text shown below field
length int No Max length for Data fields

Permission Definition

Property Type Description
role string Role name
read int Read permission
write int Write permission
create int Create permission
delete int Delete permission
submit int Submit permission
amend int Amend permission
cancel int Cancel permission

Workflow Definition

workflow attaches a runtime workflow to the MetaType. Only active workflows are loaded into the server's workflow registry.

workflow

Property Type Description
name string Workflow name
doc_type string DocType the workflow belongs to
is_active bool Enable this workflow for runtime use
states array Workflow states
transitions array Allowed transitions
sla_rules array Optional SLA definitions for workflow states

workflow.states[]

Property Type Description
name string State name
style string UI style label returned to Desk
doc_status int Optional docstatus to set on entry
update_field string Optional document field to update on entry
update_value string Value written to update_field
is_fork bool Marks a state as the entry point for parallel branches
branch_name string Branch identifier for parallel workflows
join_target string Join state name shared by related branches

workflow.transitions[]

Property Type Description
from string Source state
to string Target state
action string Action label exposed in the API and Desk
allowed_roles array Roles allowed to execute the transition
condition string Optional expr condition
require_comment bool Require a transition comment
auto_action string Optional registered post-transition handler
quorum_count int Reserved for approval-quorum workflows
quorum_roles array Reserved for approval-quorum workflows

workflow.sla_rules[]

Property Type Description
state string State the SLA applies to
max_duration duration Maximum allowed time in state
escalation_role string Role notified or assigned on breach
escalation_action string Action name associated with the escalation

Related