Triggers
A JSONtrigger
contains three different propertiesJSON trigger events | JSON trigger conditions | JSON trigger actions | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
|
Multiple trigger events can be added to a workflow.
A single trigger event will include one or more action actions.
|
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.
o
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.
o
The trigger can be added to a workflow using workflow builder but it must be added in JSON markup notation.
Code Block |
---|
"triggers": [ {"event":"on-change-state", "conditions": [ {"state":"Rejected"} ], "actions": [ {"action":"change-state", "state":"Triage"} ]} ] |
Info |
---|
If you want to add this trigger to a workflow using workflow builder, copy and paste the JSON code format (without the opening |
There are a number of events that can be used in a trigger - see JSON Trigger events
For each
event
you can set one or moreconditions
- see JSON Trigger conditionsTrigger
actions
can be added to a singleevent
- see JSON Trigger actions
Each action is enclosed in a pair of curly brackets { ... }
. Multiple actions are added as a comma-separated list. This list of actions is then enclosed in a pair of square brackets [ ...]
.
For example:
"actions":[{"action":"action1"}, { "action": "action2"}]
"actions":[{"action":"change-state", "state":"Triage"}, {"action":"set-message", "type":"warning", "body":"Rejected content, triage actions required", "mode":"autoClose"}]
Info |
---|
Each trigger action can have a number of mandatory elements and optional elements depending on the action. |
Trigger action and page workflow
historydocument activity
For audit purposes, both the rejected decision transition to the Rejected state and the subsequent trigger transition to Triage are recorded in the page workflow historydocument activity.o
Excerpt | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||||||||
If adding the JSON trigger using workflow builder there is no need to include the opening "triggers”: JSON markup notation, since it will be added by workflow builder. The example above has one trigger, the trigger uses a generic event - a state change event - but the added condition sets the trigger to only listen for the state change event to the final state in the workflow.
A trigger contains three different properties.
EventsThe event name the trigger will listen for. These include:
When creating a workflow JSON trigger
ConditionsOne or more conditions that must be met for the trigger to perform the specified action(s) for an event.
You can add more than one different condition in a comma separated bracketed list. The following is evaluated as an AND condition when using
The following is evaluated as an OR condition when using
For ActionsA list of actions to perform once the event has occurred and the conditions are fulfilled. These actions include
There are two elements that must be present for the change-state action
|