This documentation relates to the 4.3 release of Ad hoc Workflows

 Documentation for other versions of Comala Workflows is available too.

Purpose

The trigger macro is used to define a set of actions to be executed when a specified event occurs. These actions are defined in the body of the macro using one or more action macros.

Syntax

{trigger} Syntax
{trigger:event_name[label=label_name][|approval=approval_name][|state=state_name][task=task_name][|partial=true/false][initial=true/false][|queue=true/false][|newevent=newevent_name][success=true/false][|}
  <One or more action macros>
{trigger}

Parameters

Parameters

Mandatory

Default

Description

unnamed first parameter

Yes

 

Defines the specific event for which the trigger is activated. See Events for a list of valid events.

label

No

 

The name of the added or removed label for the labeladded and labelremoved events.

approval

Yes(1)

 

The name of the affected approval.

state

Yes(2)

 

The state to which the page or news/blog-post has changed

task

No(3)

 

The name of the task linked to the task event.

partial

No

false

Sets whether or not an event is valid for a partial approval (used only for pageapproved, pagerejected,newsapproved or newsrejected events). This setting is used to fire a trigger when any approver for the named approval gives their approval rather than wait until all approvals are given.

initial

No

false

When used with statechanged event, set this parameter to true  to fire this trigger only on the initial occurrence of the state named by the state parameter. This setting is useful for initializing a page.

queue

No

false

Whether or not to queue the actions. Used when the actions could take a long time to execute (for example, when publishing content).

newevent

No

 

If this value is set, then a custom event identified by this value will be published when the actions are executed, and will contain a flag success set to true or false depending on the outcome

success

No

true

This setting is used to listen for the outcome of a custom event (set by the newevent parameter in an separate trigger macro). This setting can be used to handle error in actions (for example, failure of remote publishing).

Conditions

No

 

Any other additional conditions for the trigger.

Table Notes

  1. If the event is an approval event.
  2. If the event is pagestatechanged, statechanged or newsstatechanged.

  3. If this parameter is not included for task events, the trigger applies to all tasks.

Events

Events

Description

labeladded, labelremoved

Fires when a label is added or removed.

pagecreated, pageupdated

Fires when a page is created or updated.

pagemoved

Fires when a page is moved.

newscreated, newsupdated

Fires when a news/blog-post is created or updated.

pageapproved, pagerejected

Fires when a page is approved or rejected.(1)(2)

newsapproved, newsrejected

Fires when a news/blog-post is approved or rejected.(1)(2)

pagestatechanged  or statechanged

Fires when a page's state changes.

newsstatechanged

Fires when a news/blog-post's state changes.

attachmentschanged

Fires each time an attachment is added, updated, or removed on a page or news/blog-post

attachmentadded

Fires each time an attachment is added on a page or blog-post.

attachmentremoved

Fires each time an attachment is removed on a page or blog-post.

attachmentupdated

Fires each time an attachment is updated on a page or blog-post.

taskcreated

Fires when a task is created.

taskassigned

Fires when a task is assigned.

taskcompleted

Fires when a task is completed.

taskexpired
Fires when a task expires.

pageapprovalassigned

Fires when a page approval is assigned.(2)

newsapprovalassigned

Fires when a blog post approval is assigned.(2)

approvalunassigned

Fires when an approval is unassigned.(2)

stateexpired

Fires when the specified state expires.(2)

Table Notes

  1. If the partial parameter is set to false (default) then the trigger fires only after all the required approvers have approved or rejected the page/news/blog-post. If partial is set to true, then the trigger fires when any of the required approvers have approved or rejected the page.
  2. Requires the approval parameter to be set.
  • No labels