The Workflow Builder Form allows administrators to configure automated business rules, target ERP features, execution timing, trigger actions, and custom Twig template code.
| Form Field | What the User Should Enter / Select & System Behavior |
|---|---|
| Workflow Name * | Enter a clear, descriptive title for the workflow (e.g., Check Application Slug Exists). |
| Workflow Slug * | Enter a unique lowercase string slug with hyphens (e.g., workflow-application-slug-exist). |
| Feature Slug * | Select the target ERP feature/form on which the workflow will operate. |
| Workflow Scope * | Choose Feature Scope (applies to target feature only) or Global Specific (applies globally). |
| Workflow Execution * | Choose Before Execution (runs before saving data) or After Execution (runs after saving data). |
| Workflow Action * | Choose target trigger event: View, Insert (Create), Update (Edit), Delete, or Restore. |
| Workflow Description | Enter explanatory notes describing the workflow purpose for team reference. |
| Workflow Twig | Enter Twig template code defining business rules, Query Builder calls (query()), and redirect alerts (redirect()). |
Workflow Scope determines the target reach of the workflow rule across the ERP platform:
| Action Option | Simple Explanation & Typical Use Case |
|---|---|
| View (1) | Runs when viewing a List View or Detail View page. Used to load additional context. |
| Insert (2) | Runs when saving a new record (+ Create form). Used for duplicate checks and validation. |
| Update (3) | Runs when saving changes to an existing record. Used for validation and audit logs. |
| Delete (4) | Runs when deleting a record. Used to verify deletion or create audit logs. |
| Restore (5) | Runs when restoring a soft-deleted record. Used to reactivate linked data. |
Workflow Twig allows administrators to write dynamic automation logic. Workflows integrate directly with Query Builder queries using the query('query-slug') function.
{% set slugExists = query('workflow-application-slug-exists') %} {% if slugExists is not empty %} {{ redirect( 'feature/manage/application-form', 'Application Slug Already Exists!', 'error' ) }} {% endif %} Clicking Save Workflow validates required fields and persists the record into table nm_app_workflows. The workflow takes effect immediately for all configured user operations.