---
title: "Publish a document using a Comala Document Management workflow trigger"
canonical: "https://support.appfire.com/space/AHP/650348491/Publish%20a%20document%20using%20a%20Comala%20Document%20Management%20workflow%20trigger"
format: markdown
---
> Macro (aura-html)

> Macro (excerpt)
> 
> Publish pages and blog posts using Comala Document Management and Comala Publishing

## Requirements

In the instance to set up [different space publishing using a Comala workflow](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649957805) you need

- the **Comala Publishing app** installed and enabled
- the [Comala Document Management](https://appfire.atlassian.net/wiki/spaces/CDML) app

You must have

- added a target space for the published content in the space settings of the source draft space
- an active Comala Document Management workflow on the content
- added a trigger with the [publish-page action macro](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650119708) to the applied workflow
- **view** and **edit** permission for both the source draft space and the target space for publishing

> 📝 A space administrator can also [configure the publishing dashboard](https://appfire.atlassian.net/wiki/spaces/AHP/pages/649662146) to only [publish the latest approved workflow final state version](https://appfire.atlassian.net/wiki/spaces/AHP/pages/649826124) of a page or blog post with an applied workflow when publishing the whole space using the space publishing dashboard **Publish** option.

## Workflow trigger

The **publish-page trigger** can be configured to listen to a workflow event.

This event can be a state transition - the  `statechanged` event. Events can be filtered to be constrained to a specific occurrence of the event - the `statechanged` can be filtered to a specific destination state. For example, in a workflow with a **Published** state, `state=Published`.

```
{trigger:statechanged|state=Published}
      {publish-page}
{trigger}
```

> Macro (excerpt-include)



If the **Published** state is set as the workflow final state, this allows your page editors to publish the latest approved final state version and be used together with configuring [whole space publishing to use the workflow final state version](https://appfire.atlassian.net/wiki/spaces/AHP/pages/649826124).

> 📝 You may want to disable the option to [Publish a single page](https://appfire.atlassian.net/wiki/spaces/AHP/pages/649561680) for the space when using a Comala workflow to publish a page.

## Adding a trigger to a workflow

A trigger can be added to a custom workflow as markup in either the Comala Document Management [markup editor](https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=CDML&title=Markup%20editor%20in%20workflow%20builder) or the visual editing tool [workflow builder](https://appfire.atlassian.net/wiki/spaces/CDML/pages/650151179)r.

![image](media://cbe07bc3-6ce1-4a2d-a197-61faf3221052)

The trigger can be set to listen for one [workflow event](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649759655). These events include

- `statechanged`
- `pageapproved`
- `stateexpired`

> Macro (excerpt-include)



An advanced Comala Document Management workflow can be created to [manage the publishing process](https://appfire.atlassian.net/wiki/spaces/CDML/pages/649728423), for example, to include checking the success of queued publishing actions, setting and using trigger custom events, and error handling.

## Related pages

> Macro (contentbylabel)

**[Comala Document Management](https://appfire.atlassian.net/wiki/spaces/CDML)**

> Macro (contentbylabel)

**Atlassian Marketplace**

- [Comala Document Management](https://marketplace.atlassian.com/apps/142/comala-document-management?hosting=datacenter&tab=overview)