---
title: "Use attachment events in workflow triggers"
canonical: "https://support.appfire.com/space/CDML/649662583/Use%20attachment%20events%20in%20workflow%20triggers"
format: markdown
---
> Macro (aura-html)


## Overview

> Macro (excerpt)
> 
> Triggering events when attachments are created, updated, or removed.

In the following examples, we show how to trigger a state transition when users add, update, or remove attachments to a page or blog post in a specific workflow state.

## Attachment created

If the workflow is in the **Approved** state, adding an attachment triggers a transition to the **In Progress** state.

```plaintext
{workflow:name=Attachment added}
   {state:In Progress}
   {state}
   {state:Approved}
   {state}
   {trigger:attachmentadded|state=Approved}
      {set-state:In Progress}
   {trigger}
{workflow}
```

## Attachment updated

If the workflow is in the **Approved** state, updating an attachment (uploading a new version of an existing attachment) triggers a transition to the **In Progress **state.

```plaintext
{workflow:name=Attachment updated}
   {state:In Progress}
   {state}
   {state:Approved}
   {state}
   {trigger:attachmentupdated|state=Approved}
      {set-state:In Progress}
   {trigger}
{workflow}
```

## Attachment removed

If the workflow is in the **Approved** state, deleting an attachment triggers a transition to the **In Progress** state.

```plaintext
{workflow:name=Attachment added}
   {state:In Progress}
   {state}
   {state:Approved}
   {state}
   {trigger:attachmentremoved|state=Approved}
      {set-state:In Progress}
   {trigger}
{workflow}
```

## Attachment version removed

If the workflow is in the **Approved** state, deleting an attachment version triggers a transition to the **In Progress** state.

```plaintext
{workflow:name=Attachment added}
   {state:In Progress}
   {state}
   {state:Approved}
   {state}
   {trigger:attachmentversionremoved|state=Approved}
      {set-state:In Progress}
   {trigger}
{workflow}
```

## All of the above

If you want to transition on any of the events listed above, you can use the `attachmentschanged` (note the 's') event, like so:

```plaintext
{workflow:name=Any attachment event}
   {state:In Progress}
   {state}
   {state:Approved}
   {state}
   {trigger:attachmentschanged|state=Approved} {set-message:duration=PT1M}
         Attachment added, edited or deleted:
         || File    | @filename@   |
         || Size    | @size@ bytes |
         || Comment | @comment@    |
      {set-message}
      {set-state:In Progress}
   {trigger}
{workflow}
```

We've included a message to provide some details about the attachment; the details are derived from [event references](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649925434), which are available at all attachment-related events. Here's an example output:

![image](media://cdebc743-34b5-4d47-9cf0-5a73600f91b3)