Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 workflow events

  • check for a set condition or conditions to be met for each event

  • set one or more actions for each event

A custom workflow can include one or more workflow triggers. A workflow trigger is added as JSON code using the workflow builder or the JSON editor.

Triggers

A JSON trigger contains three different elements:

Filter by label (Content by label)
showLabelsfalse
maxCheckboxfalse
sorttitle
showSpacefalse
reversetrue
cqllabel = "jsontriggerelement" and space = currentSpace ( )

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

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "jsontriggerevent" and space = currentSpace ( )
Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "jsontriggercondition" and space = currentSpace ( )
Filter by label (Content by label)
showLabelsfalse
showSpacefalse
sorttitle
cqllabel = "jsonaction" and space = currentSpace ( )

Using the workflow builder visual editor, you can You can add a workflow trigger using the code editor

cdmc_codeeditor_savedtrigger.pngImage Added

The code editor includes

  • 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

Or add the trigger JSON code directly to your custom workflow using the visual editor.

cdmc_wfbuilder_editworkflow_trigger_setmessage_statecontent_example.png

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 trigger is created using JSON code.

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 the workflow builder visual editor, copy and paste the JSON code format (without the opening "triggers": JSON markup code) to the Triggers dialog in the Edit Workflow panel in the editor.

There are a number of workflow events that can be added to a trigger. For each trigger, you can set one or more conditions, for example, to constrain a trigger to listen for an event that occurs in a particular state. One or more actions can be added to a workflow trigger undertaken when the event occurs.

Each trigger action can have a number of mandatory parameters and optional parameters depending on the action.

Related pages

Triggers

Child pages (Children Display)

Using Workflow Builder