Versions Compared

Key

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

Table of Contents
maxLevel3
minLevel2
absoluteUrltrue
typeflat
separatorpipe

Overview

Triggers can be added to

  • listen for workflow workflow events
  • check for a set set conditionor or conditionsto  to be met for each event
  • set one or moremore actionsfor  for each event

Triggers are added as JSON using workflow builder or the JSON editor and can be used to create a more flexible and responsive workflow in Comala Document Management for Cloud

Triggers

A JSON trigger contains three different properties

Child pages (Children Display)
excerptTypesimple
first3

Multiple trigger events can be added to a workflow.

A single trigger event will include one or more actions.

Example

In a 4 state workflow you might want the workflow to move from a Rejected state to a more proactively named Triage state.

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 as JSON markup format.

Code Block
"triggers":
[
	{"event":"on-change-state",
	"conditions":
	[
		{"state":"Rejected"}
	],
	"actions":
	[
		{"action":"change-state",
			"state":"Triage"}
	]}
]

There are a number of events that can be used in a trigger - please see JSON Triggers.

For each event you can set one or more conditions - please see JSON Triggers.

Trigger actions can be added to a single event - please see JSON Triggers.

For example:

  •  "actions":[{"action":"action1"}, { "action": "action2"}]

Each action 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 square brackets.

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

Trigger action and page workflow history

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 history.

o

Excerpt
hiddentrue


Code Block
"triggers":
[
   {
      "event":"on-change-state",
      "conditions":[
         {
            "final":true
         }
      ],
      "actions":[
         {
            "action":"publish-page"
         },
         {
            "action":"send-email",
            "recipients":[
               "@document_user_reviewers@",
               "@document_group_reviewers@"
            ],
            "notification":{
               "subject":"${content.title} is in Review State",
               "title":"${content.title} is in Review State",
               "body":"Hello, ${content.link} in the ${content.space} space needs to be reviewed"
            }
         }
      ]
   }
]


(info) 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 listen for a the state change event to the final state in the workflow.

Trigger One
Trigger event 

WHEN the document changes state

"event":"on-change-state"
Trigger condition for the eventAND the new state is the final state "conditions":[ { "final":true } ]
Trigger action
  • THEN the page is published to a new space*
"actions":[ { "action":"publish-page" }, ...
Trigger action
  • AND an email is sent

... { "action":"send-email", "recipients":[ "@document_user_reviewers@", "@document_group_reviewers@" ], "notification":{ "subject":"${content.title} is in Review State", "title":"${content.title} is in Review State", "body":"Hello, ${content.link} in the ${content.space} space needs to be reviewed" }}]

* This publishing action using "publish-page" is only available when the Comala Publishing for Cloud app is installed and the current space has been enabled as a draft space for publishing to target public space.

† Multiple trigger actions are added as a comma-separated list, each action enclosed in curly "{" brackets. The list of actions is then enclosed in square brackets e.g. "actions":[{"action":"action1"}, { "action": "action2"}]


Trigger properties

A trigger contains three different properties.

Table of Contents
maxLevel3
minLevel3

Events

The event name the trigger will listen for. These include:

  • "on-change-state"

  • "on-approve"

  • "on-reject"

  • "on-assign"

  • "on-unassign"

  • "on-expire"

When creating a workflow JSON trigger

  • you can add multiple events to a JSON "trigger"
  • you can only use each event type once in a JSON "trigger"

Conditions

One or more conditions that must be met for the trigger to perform the specified action(s) for an event.

  • "state": "(string value)"
  • "initial": (boolean true/false)
  • "final":(boolean true/false)
Code Block
"conditions":[{"state": "Review"}]

You can add more than one different condition in a comma separated bracketed list.

The following is evaluated as an AND condition when using initial and state conditions.

Code Block
"conditions":[{"state": "Review" },{"initial":true}]


The following is evaluated as an OR condition when using final and state conditions.

Code Block
"conditions":[{"state": "Review" },{"final":true}]
  • comma-separated list of conditions are enclosed in square brackets
  • each individual condition is enclosed in a set of curly brackets

For state condition only one state name value can be entered. Multiple state name values are not accepted.

Actions

A list of actions to perform once the event has occurred and the conditions are fulfilled. These actions include

Filter by label (Content by label)
showLabelsfalse
max20
showSpacefalse
sortcreation
cqllabel = "jsonaction" and space = currentSpace ( )

For example, the trigger action "change-state" causes a change of the state to the specified state if the provided parameters are valid.

Code Block
"actions":[{"action":"change-state","state":"Review"}]

There are two elements that must be present for the change-state action

  • define the actionusing "action":"change-state"
  • specify the destination state "state":"Review"