Add a JSON trigger using workflow builder visual editor
Overview
Triggers that listen for workflow events can be added to a workflow. These triggers can be used to create actions, for example, custom notifications.
Comala Document Control triggers are created using JSON code and can be added to a workflow using the workflow builder visual editor or the code editor.
The code editor supports reducing errors when writing JSON code. It includes autocomplete features and JSON dropdown options to add properties, values, and data, including trigger events, conditions, and actions.
Example Trigger notation
"triggers":
[
{"event": "on-change-state",
"conditions":
[
{"state": "Rejected"}
],
"actions":
[
{"action": "set-message",
"type": "info",
"title": "Hey My Wonderful design and Tech Team",
"body": "We have some work to do ... it was rejected!!!"}
]}
]
Only one overall "triggers":
will be required in the JSON code if added to a workflow using the code editor. When adding the JSON trigger notation in workflow builder visual editor you do not have to add the "triggers":
JSON element. Workflow builder will add this automatically after saving the workflow.
Adding a trigger using workflow builder
The trigger JSON code is added using the workflow builder visual editor.
Open workflow builder in the space settings Document Control dashboard
choose Edit Workflow
select Use Visual Editor in the Actions menu
In the workflow builder visual editor
choose the workflow name in the workflow panel to open the Edit Workflow panel
expand the Advanced tab in the Edit Workflow panel
Example JSON triggers can be copied, pasted and edited to the Triggers dialog box.
add the JSON code trigger markup to the Triggers dialog box
choose Apply to save the added JSON code trigger
choose Save to update the workflow in workflow builder
choose Exit to return to the space settings
The custom workflow is updated in the dashboard.
Trigger validation
The visual editor validates the added JSON code
checks the JSON format
checks inconsistencies in the trigger with the workflow, for example in referenced state names
An error in the JSON code format or an inconsistency with the workflow prevents the trigger being applied in the visual editor or saved to the workflow in the dashboard.
If the format check fails
a Wrong format breadcrumb is displayed after adding the trigger to the dialog box
the Apply option is disabled
If there is an inconsistency with the workflow, a validation error message is displayed when using Save in the visual editor.
The validation error can be caused by the trigger use of a state name that is not in the workflow. Validation fails, for example, if the name of the workflow element (state, approval) includes differences such as lower or uppercase characters; or is not present in the workflow.
See the following for further details of these validation checks:
Elements of the custom message notification trigger
In this example, the added trigger will
Listen for a state change event to the named state in the event condition - the Rejected state
{"event": "on-change-state",
"conditions":
[
{"state": "Rejected"}
]
For example, a reviewer choosing to reject the content causing a workflow approval transition to the Rejected state.
Action a custom notification once the event occurs, displaying an on-screen message for users who view the content
{"action": "set-message",
"type": "info",
"title": "Hey My Wonderful design and Tech Team",
"body": "We have some work to do ... it was rejected!!!"}