Use attachment events in workflow triggers
Overview
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.
{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.
{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.
{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.
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:
We've included a message to provide some details about the attachment; the details are derived from event references, which are available at all attachment-related events. Here's an example output: