/
Add a workflow trigger using the code editor



Add a workflow trigger using the code editor

Adding a workflow trigger

You can automate some actions in a custom workflow by adding one or more workflow triggers. A workflow trigger listens for a specific workflow event to occur, such as a change of state, and if any set conditions are met, it actions a change.

A workflow trigger can be added as JSON code using the code editor.

cdmc_codeeditor_trigger_onchangestate_approvedstate_multipleactions.png
Code editor - on change state trigger

Adding a trigger requires a number of JSON properties, values, and data:

The code editor provides the JSON schema for each workflow trigger attribute and attribute parameters with an autocomplete function.

You can toggle from the code editor to the visual editor to view a list of the workflow triggers added to the workflow.

cdmc_visualeditor_workflowpanel_oneadded_trigger.png

Adding a trigger

In the app space settings, open the code editor for a custom workflow:

  • add a trigger after the closing bracket for the last "state".

  • add a comma after the last square bracket ] but before the overall workflow closing curly brace }

  • add "" to display the JSON schema options

  • use the keyboard arrow keys to highlight and select triggers array

Add trigger attributes

You must now add the workflow trigger parameters and values - the event, conditions, and actions for the trigger.

For example, when using Create New Workflow in the space document management dashboard:

  • the starter workflow has no workflow trigger

  • the empty "triggers":[ ] property is available at the end of the template code to add one or more triggers

The trigger properties are added as contents to the square brackets [ ] in "triggers": [ ].