How to jump between tasks (then, exit, end)
Tasks run in the order listed in do. Use a flow directive to override that order.
Directive | Effect |
|---|---|
| Advance to the next task in the current list |
Task name | Move to the named task in the current list |
| Leave the current task list and return to its parent |
| End the workflow |
Select a task with switch
Each named case has a then directive. The first case whose when condition matches wins. A final case without a condition provides a fallback.
Complete the SQLite setup and keep its worker running. Run the commands from a second terminal in the setup directory. With the JAR, substitute java -jar lemline.jar for bin/lemline. The worker logs Workflow completed with output with each result. Save each definition under the file name used in its definition post command.
Expect {"orderId":"ORD-301","status":"accepted"} and {"orderId":"ORD-302","status":"needs-review"}.
After setting its status, the manual-review path uses then: exit to leave the task list instead of falling through to the automatic path. The workflow's output.as still runs, as it does after then: end.
Exit a nested task list
Here a missing order ID exits the inner do list. The outer list resumes at finalize.
With an order ID, recordOrder runs and the result is {"completed":true,"status":"received"}. Without one, the inner list exits before recordOrder and the result is {"completed":true,"status":"skipped"}.
See Flow Control for task and workflow completion behavior.