---
title: "trigger macro"
canonical: "https://support.appfire.com/space/CDML/649859133/trigger%20macro"
format: markdown
---
> Macro (aura-html)


## Overview

> Macro (excerpt)
> 
> Trigger actions when events are fired

The `trigger` macro listens for [Events](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649759655) and performs the actions in the macro body after filtering and confirming any prerequisite requirements.

## Where to use it?

Optional.

One or more `trigger` macros can be put in a [workflow macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649662219).

- can be added as markup in [workflow builder](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650248771)
- if added using the [markup editor](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649596028), the trigger(s) must be placed *after* the [state macro(s)](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649531575)

## Parameters

| Parameter | Required | Default | Notes | Ver |
| --- | --- | --- | --- | --- |
| *unnamed first parameter* | :check_mark: |  | The event to listen to – see: [Events](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649759655) |  |
| *macro body* |  |  | One or more actions to process when the trigger is activated – see [Actions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649858941) |  |
| `description` |  |  | The description for the trigger:<br>- plain text
- can use any character set supported by your Confluence server – except some [reserved characters](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649859070) | 5.7+ |
| *[conditions](#)* |  |  | Optionally apply further conditions to filter events – see [Conditions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694110). |  |
| `approval` | :info: |  | > ℹ️ Required for all events relating to the approval macro.<br>Filter to a specific `approval` name.<br>> ✅ You can filter to a specific state using the state parameter if you have more than one approval** **with the same name but in different states.<br>> Macro (contentbylabel) |  |
| `initial` |  | `false` | Only applies to `statechanged` event, for each page or blog post the workflow is applied to.<br>- `true` – only listen for the first time the workflow transitions to the **state** specified by the `state` parameter.
- `false` – listen to every time the workflow transitions to the **state** specified by the `state` parameter.<br>This parameter is primarily used to perform one-time initialization actions for a given piece of content. For example, on the first review of a piece of content, you might want to send out additional emails or set some metadata.<br>> Macro (contentbylabel) | 3.0.1+ |
| `label` |  |  | Only applies to `labeladded` and `labelremoved` events.<br>Value is the name of the label that was added or removed.<br>> Macro (contentbylabel) |  |
| `newevent` |  |  | If this value is set, 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.<br>> Macro (contentbylabel) |  |
| `parameter` | :info: |  | > ℹ️ Required for the `pageparameterupdate` event<br>The name of the parameter to monitor.<br>> Macro (contentbylabel) |  |
| `partial` |  | `false` | Only applicable to the following events: `pageapproved`, `pagerejected`, `newsapproved,` and `newsrejected`<br>- `true` – process each individual Approve or Reject
- `false` – wait until all reviewers agree on either Approve or Reject<br>> Macro (contentbylabel) |  |
| `queue` |  | `false` | Should actions be queued?<br>- `true` – Yes, queue them
- `false` – No, run them immediately<br>If actions are likely to take a long time to process, for example, when remote publishing content, they should be queued so the end user doesn't have to wait for them to finish before continuing with their work.<br>> Macro (contentbylabel) |  |
| `state` | :info: |  | > ℹ️ Required for the following events:
> ℹ️ 
> ℹ️ - `pagestatechanged`
> ℹ️ - `statechanged`
> ℹ️ - `newsstatechanged`<br>Filter to a specific active **state** of the workflow.<br>> 📝 Only a single state can be specified and can't be negated.<br>> Macro (contentbylabel) |  |
| `success` |  | `true` | This setting is used to listen for the outcome of a custom event (set by the `newevent` parameter in a separate trigger macro). This setting can handle an error in an action (for example, failure of remote publishing).<br>> Macro (contentbylabel) |  |
| `task` | :info: |  | > ℹ️ If not specified, the trigger will listen for all tasks rather than a specific task.<br>Filter to a specific `task` name.<br>> Macro (contentbylabel) |  |

## Example

The workflow has two triggers, each listening for a different approval event for the **Content Review **approval in the **Review** state.

These are

- a `pageapproved` event trigger
- a `pagerejected` event trigger

```plaintext
{workflow:Example Trigger Workflow}
   {state:Editing|submit=Review}
   {state}
   {state:Review|approved=Published|rejected=Editing}
      {approval:Content Review}
   {state}
   {state:Published|final=true|updated=Editing}
   {state}
   {trigger:pageapproved|approval=Content Review}
      {set-message:style=success}This page has been approved!{set-message}
   {trigger}
   {trigger:pagerejected|approval=Content Review}
      {set-message:style=error}This page was rejected, please make requested changes.{set-message}
   {trigger}
{workflow}
```

You can view and edit a workflow** **in [workflow builder](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650151179).

![image](media://1f11c291-99a3-4fac-8efe-5671155ca2ca)

In workflow builder, the trigger is added to the workflow using markup.

![image](media://08ea79a0-53fc-4415-b527-ac3fb9be1a6b)

Once added to the workflow, each trigger is displayed as a non-editable workflow **Rule**. 

![image](media://5eb4158f-180b-421f-b1fa-1e87efe45dc4)

**Rules **simply display the event and event filter for each trigger. To change a trigger, you must edit the trigger markup.

## All examples

> Macro (contentbylabel)

## See also

[Workflow Authoring Guide](https://appfire.atlassian.net/wiki/spaces/CDML/pages/648611901):

- [Events](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649759655)
- [Triggers](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649563178)
- [Actions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649858941)
- [Conditions](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694110)
- [Value References](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649694302)

[User Guide](https://appfire.atlassian.net/wiki/spaces/CDML/pages/648907144):

- [Workflow Builder](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650151179)