Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
maxLevel3
minLevel2
absoluteUrltrue
typeflat
separatorpipe

Overview

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

Triggers are

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

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

elements:

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

Multiple

trigger events

triggers can be added to a workflow

and each single trigger event will Using

. A trigger for an event must include at least one or more actions.

Related Pages

Child pages (Children Display)

Workflow

BuilderAdd a JSON

trigger

using workflow builder
  • JSON triggers in the Content Expiry and QMS workflows

  • Multiple JSON triggers in a custom workflow

  • JSON trigger

    events

    JSON

    Workflow trigger conditions

    JSON

    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
    maxCheckbox
    showSpacefalse
    sorttitle
    showSpacefalsereversefalse
    cqllabel = "jsonaction" and space = currentSpace ( )
    and parent = "657364333"

    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

    cdmc_code_editor_jsonschema_help_triggers_event.pngImage Added
    • code validation

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

    cdmc_wfbuilder_editworkflow_trigger_setmessage_statecontent_example.pngImage Added

    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.

    oImage RemovedImage Added

    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.

    oImage Removed

    The trigger can be added to a workflow using workflow builder but it must be added in JSON markup notationis 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 notationcode) to the Triggers dialog in the Edit Workflow panel in workflow builderthe editor.

    There are a number of workflow events that can be

    used in

    added to a trigger

    - see JSON Trigger events

    . For each

    event

    trigger, you can set one or more conditions

    - see JSON Trigger conditions
  • Trigger actions can be added to a single event- see JSON Trigger actions

  • 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 [ ...].

    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

    , 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

    elements

    parameters and optional

    elements

    parameters depending on the action.

    Trigger action and page workflow 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 document activity.

    Image Removed 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 only listen for 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 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 action using [{"action":"change-state", ...

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

    Related pages

    Triggers

    Child pages (Children Display)

    Using Workflow Builder