Workflow
MegaForm Workflow turns a form submission into a business process. You design a flowchart of triggers, conditions, and actions; when a submission arrives or a field changes, the workflow engine executes the flow.
Core concepts
| Term | Meaning |
|---|---|
| Workflow | A named process attached to one or more forms |
| Trigger | The event that starts a workflow run |
| Step / Node | A single action or decision in the flow |
| Run | One execution of a workflow for a specific submission |
| Context | The submission's field values plus runtime variables (_submissionId, now, currentUser, β¦) |
Workflow canvas
The visual designer shows the flow from top to bottom:
π₯ On Submit
β
βΌ
β Priority = critical?
YES β β NO
βΌ βΌ
Assign Round Robin
Senior β
β β
βΌ βΌ
Notify Manager Notify Agent
β
βΌ
π§ Confirm to Submitter
- Drag nodes from the toolbar.
- Connect nodes by drawing edges.
- Click a node to edit its properties in the right panel.
Triggers
| Trigger | Fires when⦠| Example config |
|---|---|---|
on_submit |
A form is submitted | { "formId": 5 } |
on_update |
A record is edited | { "formId": 5, "watchFields": ["status"] } |
on_field_change |
A specific field changes | { "formId": 5, "field": "status", "from": "open", "to": "resolved" } |
on_status_change |
The status field changes | { "formId": 5, "statusField": "status" } |
scheduled |
A cron schedule elapses | { "cron": "0 8 * * *", "formId": 5 } |
manual |
A user clicks a button | { "formId": 5, "buttonLabel": "Approve" } |
webhook_received |
An external webhook arrives | { "endpoint": "/hook/crm-sync" } |
on_date |
A date field is reached | { "formId": 5, "dateField": "due_date", "offset": "-1d" } |
Node types
Condition
Branch the flow based on field values:
{
"type": "condition",
"config": {
"conditions": [
{ "field": "deal_value", "operator": "greaterThan", "value": 10000 },
{ "field": "category", "operator": "equals", "value": "enterprise" }
],
"logic": "and"
},
"onTrue": "step_approve",
"onFalse": "step_review"
}
Operators include: equals, notEquals, contains, startsWith, endsWith,
greaterThan, lessThan, greaterOrEqual, lessOrEqual, in, notIn,
isEmpty, isNotEmpty, matchesRegex.
Update Field
Set one or more field values:
{
"type": "update_field",
"config": {
"updates": [
{ "field": "status", "value": "approved" },
{ "field": "approved_date", "value": "{{now}}" },
{ "field": "approved_by", "value": "{{currentUser}}" }
]
}
}
Send Email
Send HTML or plain-text email with token substitution:
{
"type": "send_email",
"config": {
"to": "{{email}}",
"cc": "manager@company.com",
"subject": "Your request has been {{status}}",
"body": "Dear {{full_name}},\n\nYour request #{{_submissionId}} has been {{status}}.",
"attachFields": ["resume"],
"replyTo": "support@company.com"
}
}
Approval
Create a human approval task:
{
"type": "approval",
"config": {
"approvers": { "type": "field", "field": "manager_email" },
"approvalField": "_approval_status",
"onApprove": "step_approved",
"onReject": "step_rejected",
"reminderAfter": "24h",
"escalateAfter": "72h",
"escalateTo": "director@company.com"
}
}
Approvers can also be a fixed role, a list of emails, or a round-robin pool.
Webhook
Call an external HTTP endpoint:
{
"type": "webhook",
"config": {
"url": "https://hooks.slack.com/services/...",
"method": "POST",
"headers": { "Content-Type": "application/json" },
"body": { "text": "New ticket from {{full_name}}: {{title}}" },
"retryCount": 3,
"timeout": 30
}
}
Calculate
Compute values from other fields:
{
"type": "calculate",
"config": {
"updates": [
{ "field": "total", "formula": "{{quantity}} * {{unit_price}}" },
{ "field": "tax", "formula": "{{total}} * 0.1" },
{ "field": "grand_total", "formula": "{{total}} + {{tax}}" }
]
}
}
Other nodes
- Create Record β insert a record into another form.
- Notify β send an in-app notification.
- Wait β pause for a duration or until a date.
- Assign β round-robin or load-balance assignment.
- Generate PDF β create a PDF from a template.
- Database β run a SQL statement.
- Google Sheets β push a row to Google Sheets.
- Add Role / Add User β identity-management actions.
Common examples
Helpdesk ticket escalation
on_submitβ auto-assign round-robin β email submitter confirmation.scheduledevery hour β find tickets open > 24h β set statusoverdueβ notify agent.scheduledevery 4 hours β find overdue > 48h β escalate to manager.on_field_changestatus βresolvedβ email submitter + wait 72h + send survey.
CRM lead pipeline
on_submitlead form β create CRM contact record β assign senior sales if enterprise, else round-robin β send welcome email.on_field_changedeal_value> $50K β notify VP Sales.on_field_changestatus βwonβ generate invoice + webhook to accounting.
HR leave request
on_submitleave request β create approval task for manager.- Approval approved β set status
approvedβ notify employee β update leave balance. - Approval rejected β set status
rejectedβ notify employee with reason.
Monitoring runs
The workflow engine stores:
MF_Workflowsβ definitionsMF_WorkflowRunsβ one row per run with status and error messageMF_WorkflowStepLogβ one row per executed stepMF_Approvalsβ pending and resolved approval tasksMF_ScheduledTasksβ future tasks (wait, reminder, escalation, scheduled triggers)
Admins can inspect runs from the dashboard to see exactly which nodes executed and where a run failed.
Permissions
Designing workflows requires the module permission MEGAFORM_WORKFLOW (typically Admins).
Running workflows is automatic and subject to the form-level permissions of the triggering
submission.