Introducing a new way to review your PRs.

Read the announcement

frappe / crm

Fully featured, open source CRM

View on GitHub

24 documents · Updated Nov 23, 2026

docs / workflow-automation-designer

Workflow automation designer

The workflow automation designer is the settings workspace for turning a business event into a visible, testable flow of actions. It lets an engineer choose when a flow starts, arrange steps and branches, set the records and values that each step uses, check that the flow is ready, and inspect what a trial run did. See Workflow automation for the wider runtime and product model.

Designer workspace

The designer combines a graph canvas with an inspector. The canvas shows the order and branches of the flow, while the inspector edits the selected trigger or step without hiding the rest of the graph. frontend/…/WorkflowAutomationBuilder.vue coordinates the editor, test tab, save state, undo history, and selected item.

The main lifecycle is:

flowchart LR
    A[Choose document type] --> B[Choose trigger]
    B --> C[Add blocks and actions]
    C --> D[Edit conditions and parameters]
    D --> E[Validate and save]
    E --> F[Select a record]
    F --> G[Run a trial]
    G --> H[Inspect steps and branch path]

Graph canvas

The graph presents the trigger as the start node and lays later steps from left to right. An If step creates True and False arms. A Wait for event step creates Event happened and Timed out arms. Each arm can continue into more steps, and the flow can join again after both arms have content. frontend/…/WorkflowFlow.vue provides the editable and read-only canvas.

The canvas only offers an add control where a new block can extend the flow. This keeps a branch open until both arms have a path and prevents a continuation from appearing before the branch is complete. The same graph is used for editing, the read-only detail view, and trial-run status display.

References: frontend/…/WorkflowFlow.vue• L1-18 frontend/…/WorkflowFlow.vue• L242-291 frontend/…/workflowGraph.js• L9-18 frontend/…/workflowEdges.js• L3-33

Flow blocks

The block picker offers flow control and actions that the selected document type supports. The core flow controls are If / Else, Wait, and Wait for event; registered actions appear in groups by app. A new block starts with safe defaults so its card and its saved meaning do not disagree before the user opens it. frontend/…/workflowBlocks.js defines this block vocabulary.

The editor shows a tree-like graph, but the saved action rows retain parent and branch information so the runtime can follow the same order. A wait for an event is presented as one block even though its result has two paths. This keeps runtime plumbing out of the user-facing flow while preserving the event and timeout outcomes.

References: frontend/…/workflowBlocks.js• L7-45 frontend/…/workflowSteps.js• L1-18 frontend/…/workflowSteps.js• L54-99

Trigger and condition editing

The inspector defines the event that starts the flow and the rules that limit when work may run. It uses the selected document type to offer valid fields, events, actions, and relationships. frontend/…/WorkflowAutomationInspector.vue is the main entry point for these settings.

Trigger selection

Triggers start a run from a record change, a schedule, a date, a manual request, or a named event. Record triggers cover creation, update, field change, deletion, submission, and cancellation. Document-specific activity events are shown when the selected document type declares them. frontend/…/workflowTriggers.js groups these choices for the canvas and inspector.

Each trigger type has its own detail values. A field-change trigger needs the watched field and can limit the old and new values. A scheduled trigger needs a cron schedule. A date trigger needs a date field, offset, and direction. A custom event needs an event name. The trigger card stays incomplete until the required detail is present.

References: frontend/…/workflowTriggers.js• L22-96 frontend/…/WorkflowTriggerDetails.vue• L1-73 frontend/…/workflowValidation.js• L4-20

Record filters and expressions

Trigger filters decide whether a matching event should start a run. Step conditions decide whether an individual step should run. An If condition decides which branch continues. The editor offers filter rows for simple comparisons and an expression mode for Python expressions that need more control. frontend/…/WorkflowConditionEditor.vue selects the mode that can represent the current value.

Filter rows support field comparisons, presence checks, membership, text containment, and grouped and or or logic. The editor converts those rows to the expression used by the automation engine and reads compatible expressions back into rows. If an expression cannot be represented without changing its meaning, the editor keeps it in expression mode instead of rewriting it.

References: frontend/…/WorkflowFilters.vue• L6-37 frontend/…/WorkflowConditionEditor.vue• L8-32 frontend/…/workflowConditions.js• L19-29 frontend/…/workflowConditions.js• L61-140

A related record condition checks records reached through a relationship rather than only the current record. The designer can test that a related record exists, that none exists, or that the related count meets a comparison. Filters in this section apply to the related record type, and template values can refer to the trigger record. frontend/…/WorkflowRelatedCondition.vue owns this focused check.

This condition depends on the selected source alias and relationship. The source may be the trigger record or a result produced by an earlier step. The available relationship and field choices therefore change as the flow gains new targets.

References: frontend/…/WorkflowRelatedCondition.vue• L1-75 frontend/…/WorkflowRelatedCondition.vue• L109-161

Step targets and parameters

Each action step needs a record target and the values required by its action schema. The designer keeps those choices in the context of the flow so a later step can use the trigger record, a declared relationship, or an earlier step result.

Record relationships

The target picker names the record on which a step acts. trigger means the record that started the run. A flow can declare relationship aliases, and an earlier action can expose an output alias. The target picker only offers aliases that exist before the selected step, which stops a step from referring to a future result. frontend/…/workflowCapabilities.js builds this target set.

Some relationships resolve to one document type. Others can resolve to several types at run time. Until the type is known, the designer cannot safely offer the target's fields or actions, so it keeps that uncertainty visible instead of presenting invalid choices. frontend/…/WorkflowTargetPicker.vue shows the target and its resolution state.

References: frontend/…/workflowCapabilities.js• L81-134 frontend/…/workflowSteps.js• L251-267 frontend/…/WorkflowTargetPicker.vue• L27-44

Action parameters

The parameter editor turns the action definition into controls that match the value type. Links use record pickers, select fields use their allowed choices, numeric fields use numeric input, and text fields can receive field tokens for run-time values. Required values are marked in the inspector and checked again before save. frontend/…/WorkflowParamEditor.vue provides the common parameter experience.

Setting fields supports both one field/value pair and a set of field values. The editor presents both forms as rows and saves them as one values map. It does not keep an empty field row as a real parameter, so unfinished rows do not write incomplete field names into the flow.

Wait steps accept a duration and unit. Wait-for-event steps accept an event, an optional correlation key, and a timeout. The event choice can supply a matching correlation option so the step can wait for the event belonging to the same record or message.

References: frontend/…/WorkflowParamEditor.vue• L1-155 frontend/…/WorkflowParamEditor.vue• L238-313 frontend/…/workflowParams.js• L18-44 frontend/…/WorkflowStepEditor.vue• L28-96

Step identity and outputs

Each step has a name used in run logs and in paths that later steps can read. The designer suggests a unique name from the step action or type, while the Advanced section lets an engineer set one when a stable name matters. An action with an output can also expose a result alias for later targeting. frontend/…/WorkflowStepEditor.vue explains these links in the Advanced section.

The available output paths and target aliases grow in step order. This gives the flow a clear dependency boundary: a step can use earlier results, but it cannot use a result that the runtime has not produced yet.

References: frontend/…/WorkflowStepEditor.vue• L137-187 frontend/…/workflowSteps.js• L101-127 frontend/…/workflowCapabilities.js• L122-134

Validation and saving

Saving converts the edited graph into the flow record expected by the automation engine. The designer checks the trigger first, then finds the first incomplete step and marks that node so the user can fix the blocking item. frontend/…/WorkflowAutomationBuilder.vue owns this save boundary.

Validation state

The canvas shows an incomplete marker when a trigger or step lacks a required value. Typical blockers include a missing trigger detail, action choice, action parameter, condition, wait duration, or event. Server errors that identify an action row are mapped back to the matching graph node so the error stays attached to the part of the flow that needs attention.

References: frontend/…/workflowValidation.js• L14-59 frontend/…/workflowGraph.js• L41-59 frontend/…/WorkflowAutomationBuilder.vue• L511-537 frontend/…/WorkflowAutomationBuilder.vue• L584-600

Save and enable state

The builder tracks changes against the last loaded or saved snapshot and warns before closing with unsaved work. A new flow can be saved as a draft. The enabled switch is available only after a trigger exists, and testing is available only after the current flow has been saved. frontend/…/WorkflowAutomationPage.vue also protects users from losing edits when the builder closes.

References: frontend/…/WorkflowAutomationBuilder.vue• L53-90 frontend/…/WorkflowAutomationBuilder.vue• L272-281 frontend/…/WorkflowAutomationPage.vue• L253-277

Trial runs

The Test Run tab executes the saved flow against a selected record and presents the result on the same graph. This lets an engineer check trigger data, conditions, action parameters, branch choice, and failure detail without treating unsaved editor changes as executable behavior. frontend/…/WorkflowTrialRun.vue provides the trial surface.

Trial run inputs

For a document-backed flow, the engineer selects a record of the flow's document type. The test button stays unavailable until that choice is made. A manual flow can run without a record name when the server accepts that input. The request includes the flow name, selected record, and any branch choice used for a retry.

References: frontend/…/WorkflowTrialRun.vue• L4-29 frontend/…/WorkflowTrialRun.vue• L250-287 frontend/…/WorkflowAutomationBuilder.vue• L275-276

Trial run playback

The result contains a summary and an ordered step trace. The designer reveals the trace one step at a time, marks the active step, records each outcome, and dims the path that the record did not take. The summary reports how many steps ran and exposes failed-step messages and trace detail.

When a condition or event wait chooses one arm, the other arm remains visible as an off-path branch. After the run ends, the engineer can run a populated alternate arm with a branch override. This makes branch testing possible without changing the saved flow.

References: frontend/…/WorkflowTrialRun.vue• L36-89 frontend/…/WorkflowTrialRun.vue• L147-230 frontend/…/WorkflowTrialRun.vue• L301-339 frontend/…/WorkflowFlow.vue• L337-350

Run inspection

Run inspection connects the graph to the outcome of a real or trial execution. The read-only detail view uses the same node and edge model as the editor, while the trial view adds status, path, duration, message, and failure information to each step. frontend/…/WorkflowAutomationDetail.vue is the saved-flow view.

Run status

Step status is shown directly on the graph as running, successful, skipped, waiting, or failed. A failed step can show its message and traceback. A setup failure is shown as a failure before the first step, which distinguishes flow setup problems from action failures.

References: frontend/…/WorkflowTrialRun.vue• L107-113 frontend/…/WorkflowTrialRun.vue• L206-240 frontend/…/WorkflowAutomationDetail.vue• L41-50

Run history

The run-history surface reads background-task records for the selected automation and shows the latest status, start time, reference record, and error summary. It gives a quick operational view after a flow is enabled, while the trial tab gives the deeper step-by-step view of one selected run. frontend/…/WorkflowAutomationRuns.vue defines this history view.

References: frontend/…/WorkflowAutomationRuns.vue• L1-30 frontend/…/WorkflowAutomationRuns.vue• L42-74

Change checklist

When these files or sections are changed, remember to consider these:

  • A document type or capability change must keep trigger fields, event choices, action schemas, relationship targets, and target-specific field controls aligned.
  • A graph or branch change must preserve the saved parent and branch links, edge labels, step order, and the row indexes used to identify run paths.
  • An action schema change must update its parameter controls, required-value checks, output type, and any later-step target choices.
  • A condition grammar change must preserve the round trip between filter rows and the expression evaluated by the engine. Expressions that the filter editor cannot represent must remain editable as expressions.
  • A step-key or output-path change must preserve the names used by run traces and by later steps that read context.steps results.
  • Trial runs must continue to execute the saved snapshot rather than unsaved editor state.

Important failure modes

TriggerConsequenceGuard
A trigger needs a field, schedule, date field, or event that is still emptySave stops before the flow can be enabledTrigger validation marks the trigger as incomplete and reports the missing detail
An action or control step lacks a required valueSave stops at the first blocking stepStep validation checks action schemas and control-specific requirements
A condition uses syntax that filter rows cannot representRewriting it as filters could change runtime behaviorThe editor keeps the expression mode and does not offer a lossy conversion
A step targets a relationship or output that is not available yetThe step may have no valid fields or action choicesTarget options are limited to the trigger, declared relationships, and earlier outputs
The flow has unsaved edits when the user opens Test RunThe test would not match what the user sees in the editorTesting stays disabled until the saved snapshot is clean
A trial run fails before its first actionNo action node can carry the errorThe run reports a setup failure as a distinct pre-step result

Key files

FileWhy to read it
frontend/…/WorkflowAutomationBuilder.vueMain editor lifecycle for loading, editing, validation, saving, and test readiness
frontend/…/WorkflowFlow.vueCanvas behavior for selection, adding blocks, branch controls, status, and read-only display
frontend/…/workflowGraph.jsGraph node presentation and incomplete-state display
frontend/…/workflowSteps.jsFlow shape, branch structure, step order, step keys, and saved-row mapping
frontend/…/workflowTriggers.jsTrigger categories and document-specific event choices
frontend/…/WorkflowAutomationInspector.vueTrigger and step settings entry point
frontend/…/WorkflowTriggerDetails.vueTrigger-specific field, schedule, date, and event settings
frontend/…/WorkflowConditionEditor.vueFilter and expression editing modes
frontend/…/workflowConditions.jsCondition conversion and safe filter-expression round trips
frontend/…/WorkflowStepEditor.vueStep types, targets, conditions, advanced names, and outputs
frontend/…/WorkflowParamEditor.vueAction parameter controls and field-value editing
frontend/…/workflowCapabilities.jsCapability loading and target-aware fields, actions, events, and relationships
frontend/…/WorkflowTrialRun.vueTrial execution, playback, branch path, and failure inspection
frontend/…/WorkflowAutomationRuns.vueRecent background-run status and error summary