Workflow Builder Form Guide

The Workflow Builder Form allows administrators to configure automated business rules, target ERP features, execution timing, trigger actions, and custom Twig template code.

Workflow Builder Form

Workflow Editor Controls

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 Explanation

Workflow Scope determines the target reach of the workflow rule across the ERP platform:

  • Feature Scope (Scope = 1): The workflow executes ONLY when an end user performs an action on the designated target Feature Slug (e.g., application-form).
  • Global Specific (Scope = 2): The workflow executes globally across ALL features in Ojoo Business OS whenever the matching Action occurs.

Before / After Execution Flow

Before Execution
User Action (Click Save) → Workflow Executes → Logic Runs → Main Operation Continues OR Halts with Flash Redirect Alert
After Execution
User Action (Click Save) → Main Operation Executes (DB Write) → Workflow Executes → Audit Logs / Emails Processed

Workflow Actions

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 & Query Builder Integration

Workflow Twig allows administrators to write dynamic automation logic. Workflows integrate directly with Query Builder queries using the query('query-slug') function.

Example Twig Validation Code:
{% set slugExists = query('workflow-application-slug-exists') %} {% if slugExists is not empty %} {{ redirect( 'feature/manage/application-form', 'Application Slug Already Exists!', 'error' ) }} {% endif %}

Saving & Managing Workflows

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.