Triggers
Overview
You can use workflow triggers to help automate your documentation process and flexibly respond to workflow events.
For example, you can use a trigger to automatically send an email when a page is submitted for review.
Triggers can be added to
listen for a single workflow
event
check if the required
conditions
are met for the eventset one or more
actions
for the event
A custom workflow can include one or more workflow triggers. A workflow trigger can be added using the visual editor or as JSON code using the code editor.
Triggers
Workflow triggers consist of the following elements:
Multiple triggers can be added to a workflow. A trigger for an event must include at least one or more actions.
Workflow trigger events | Workflow trigger conditions | Workflow trigger actions |
---|---|---|
Add a trigger to a workflow
A space administrator can add one or more workflow triggers to a custom workflow using either the visual editor or the code editor.
A trigger added to a workflow is displayed in the workflow builder visual editor workflow panel.
Use the visual editor
Add one or more workflow triggers using the visual editor.
The visual editor lets you
select an Event for a trigger
include an optional Condition for the event
The event and condition are chosen from a dropdown list of available options.
You can then include one or more Actions for the trigger using the Add Action option
The Add Action dialog box lets you choose an action, such as the Set Message action.
Use the code editor
can use the code editor to add a workflow trigger as JSON code to a custom workflow.
The code editor includes JSON schema to help you add and edit the workflow template code:
color coding to easily distinguish property names, values, and different data types
autocomplete features
dropdown selectors for workflow trigger events, conditions, and action properties
code validation
You can toggle between the code editor and the visual editor. Changes made in one editor are automatically updated in the other editor.
Example
In a 4-state workflow, you might want the workflow to move immediately from a Rejected state to a more proactively named Triage state rather than waiting for a user to manually transition the content.
You can use a trigger to listen for the state change event to the Rejected state and set the trigger action to immediately transition to the Triage state.
The JSON code for the trigger is
"triggers":
[
{"event":"on-change-state",
"conditions":
[
{"state":"Rejected"}
],
"actions":
[
{"action":"change-state",
"state":"Triage"}
]}
]
Related pages
Triggers
Add a workflow trigger