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 events

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

  • set one or more actions 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

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

Multiple trigger events can be added to a workflow and each single trigger event will include at least one or more actions.

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.

JSON trigger events

JSON trigger conditions

JSON 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 ( )

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

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 "triggers": JSON markup notation) to the Triggers dialog in the Edit Workflow panel in workflow builder.

  • There are a number of events that can be used in a trigger -

please .
  • For each event you can set one or more conditions -

please .
  • Trigger actions can be added to a single event-

please .

For example:

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

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 [ ..(info) .].

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

history

document 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.oImage Removed

Image Added
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  If adding the JSON trigger using workflow builder there is no need to include the opening "triggerstriggers”:" JSON markup notation, since It 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 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 event

AND 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 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  "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 action using [{"action":"change-state", ...

  • specify the destination state ..."statestate":"Review"}]