Workflows for builders
Part 2, chapter 19. A workflow runs steps around an operation of the system, most often publishing: "send every article to an editor for approval before it is published", "publish this at a date". Builders set workflows up in the administration; developers add new kinds of steps (Workflow event types). The complete guide is Workflows; this chapter is the builder's summary.
The pieces
| Piece | What it is | Where |
|---|---|---|
| Workflow | an ordered list of events | Setup > Workflows (/workflow/grouplist) |
| Event | one step, of an event type | the workflow's edit page |
| Trigger | connects a workflow to an operation, before or after it (pre_publish, post_publish) | Setup > Triggers (/trigger/list) |
| Process | one run of a workflow for one object and version that has not finished | Setup > Workflow processes (/workflow/processlist) |
| Workflow cronjob | resumes processes that wait | cronjobs/workflow.php |
Event types that need no code
The kernel ships these (workflow.ini [EventSettings] AvailableEventTypes[]):
| Type | Does |
|---|---|
| Approve | holds publishing until an approver approves |
| Wait until date | holds publishing until a date in an attribute |
| Multiplexer | runs another workflow only for some sections, classes or users |
| Payment gateway | holds an order until payment (shop) |
| Simple shipping | adds shipping cost to an order (shop) |
| Finish user register | completes a user registration |
Extensions add more; swark, for example, ships event types in eventtypes/event/.
Worked plan: approval before publishing
Setup > Workflows: create a workflow "Approve articles" with one event Approve, choosing the approvers (a user group), and the sections, languages or classes it applies to.
Setup > Triggers: connect the workflow to
content,publish, before.Make sure the workflow cronjob runs (
cronjob.ini, partfrequent):php runcronjobs.php -s <siteaccess> --script=workflow.phpTry it: an editor publishes an article; it waits as pending; the approver approves it in their collaboration inbox; the next run of the workflow cronjob publishes it.
The guide walks through each screen: Workflows.
Using a multiplexer to target
A trigger runs one workflow for all publishing. To approve only articles in one section, make the triggered workflow a Multiplexer that starts "Approve articles" only for the class Article and the section you choose.
When a builder needs a developer
| You need | Use |
|---|---|
| A step the list does not have (notify an external system, set a field, move content) | a custom workflow event type (With RAD: a workflow event) |
| Something on publish that never waits and never asks | often simpler as an event listener (Events, listeners and filters) |
Troubleshooting
| Symptom | Check |
|---|---|
| Articles stay pending forever | does the workflow cronjob run? Setup > Workflow processes lists waiting processes |
| The approver gets nothing | the approvers chosen in the event; their collaboration inbox |
| The workflow runs for everything | the trigger has no filter; use a multiplexer |
Related pages
- Previous: Sections, roles and access for builders
- Next: Cronjobs for builders
- Workflows
- Triggers and workflows for developers
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.