Triggers
Overview
Triggers are used to create a more flexible and responsive workflow. When a set event or action occurs, such as the assignment of a reviewer or a change of workflow state, you can use a workflow trigger to undertake actions, such as a change of state or completing an approval.
One or more workflow triggers can be added to a workflow. Each workflow trigger is set to
listen for a single workflow event, such as a change of state (
"on-change-state"
event)check that a set condition is met for the event, such as the state is the final state in the workflow ("
final":true
condition)when the condition is met for the event, set one or more actions, such as sending a custom email (
"send-email"
action)
Triggers are added to a workflow as JSON code. They can be added using workflow builder or the code editor.
JSON Triggers are used to create a more flexible and responsive workflow.
Example
In the example below
the workflow trigger listens for a change of state
the set condition constrains the workflow trigger to listen for the state change to the Rejected state
once this event occurs, the workflow trigger actions a change of state back to the Draft state
o
If the JSON trigger is added using the workflow builder, there is no need to include the "triggers": JSON element. The workflow builder adds this automatically.
There is a range of workflow events for which a trigger can be set to listen. These include
approval event
a reviewer assignment or unassignment event
a change of workflow state
You can constrain the events by adding conditions for the event, such as
a named state in the workflow
the final state
the initial transition to a named state
Trigger actions include
changing the state
assign or unassign a Confluence user or Confluence groups as reviewers to an approval
approve or reject an approval
set a state expiration due date period
create a custom notification, such as an email or on-screen message
remove page-level user permissions†
† Only 'Confluence Cloud Standard, Premium, and Enterprise Plans' enable customers to edit permissions, including global, space, and page permissions