---
title: "Comala Publishing Cloud Fails to Auto-Publish on CDM Final State"
canonical: "https://support.appfire.com/space/SUPPORT/3808526430/Comala+Publishing+Cloud+Fails+to+Auto-Publish+on+CDM+Final+State"
format: markdown
---
## Summary

This article addresses an issue where automatic publishing from a source space to a target space fails when a page reaches the final workflow state in **Comala Document Management**.

The root cause is a conflict between the app's **Default Behavior** and **Explicit Mode**. When a workflow contains a `publish-page` trigger action anywhere in its configuration, the app switches to "Explicit Mode," which silently disables the default automatic publishing on the final state. This article explains how to identify this conflict and restore the desired behavior.

---

## Use Case 1: Restoring Default Automatic Publishing

### Problem

A page reaches the final state of a workflow (e.g., "Published"), but Comala Publishing does not trigger. The publishing status remains "New" or "Out of Sync," and users must manually click the **Publish** button to sync the page to the target space.

### Cause: The "Explicit Mode" Conflict

Comala Publishing has two modes of operation when integrated with workflows:

1. **Default Behavior:** The app automatically [publishes the page whenever it enters the ](https://support.appfire.com/space/CPCL/646120872/Publishing#Publish-on-transition-to-the-workflow-final-state)**[final state](https://support.appfire.com/space/CPCL/646120872/Publishing#Publish-on-transition-to-the-workflow-final-state)**[ of the workflow](https://support.appfire.com/space/CPCL/646120872/Publishing#Publish-on-transition-to-the-workflow-final-state).
2. **Explicit Mode:** Triggered automatically if [the workflow JSON contains](https://support.appfire.com/space/CPCL/646120872/Publishing#Publish-a-page-on-a-workflow-event-using-a-workflow-trigger) a `publish-page` trigger action anywhere. In this mode, the app assumes the workflow will handle all publishing explicitly, and **it disables the default final-state publishing.**

This conflict usually happens in one of two ways:

- **An **`on-approve` trigger on a final state without an approval step: The workflow has a `publish-page` trigger set to `"event": "on-approve"` on the final state ("Published"). The "Published" state is only reached through transitions or manual state changes and has no approval step, so this trigger never fires. Even so, because the trigger is there, the app stays in Explicit Mode and the default automatic publishing on the final state stays disabled.
- **A trigger on an intermediate state:** The workflow has a `publish-page` trigger for an earlier state (such as "In Progress" or "Review" to publish drafts to a preview space). Even though this trigger works for that state, its presence turns off the automatic publish when the page later reaches the final state.

### Solution

To restore default behavior so pages automatically publish upon entering the final state, you must remove **all** triggers containing a `publish-page` action from the workflow JSON. Leaving even one `publish-page` action anywhere in the workflow keeps the app in Explicit Mode and continues to block default publishing.

**Steps to fix:**

1. Navigate to the space where the workflow is applied.
2. Open the **Workflow Builder** and switch to the **JSON/Code Editor**.
3. Search for the `publish-page` action block.
4. Delete every trigger block that contains a `publish-page` action. Example of the code to remove:

```json
{
  "event": "on-approve",
  "conditions": [
    {
      "state": "Published"
    }
  ],
  "actions": [
    {
      "action": "publish-page"
    }
  ]
}
```

5. Clean up any trailing commas so the `triggers` array remains valid JSON.
6. **Save** the workflow.

Once no `publish-page` actions remain in the workflow, Comala Publishing reverts to its default behavior and will publish pages automatically as soon as they reach the final state.

---

## Use Case 2: Maintaining "Explicit Mode" with Final State Publishing

### Problem

You need a `publish-page` trigger for a specific non-final state (e.g., to publish a "Draft" to a preview space), but you *also* want the page to publish when it reaches the final state.

### Cause

As noted above, adding the first trigger disables the default final-state automation. To publish at both points, you must define both explicitly.

### Solution

If you choose to use Explicit Mode, you must add a specific `publish-page` trigger for the final state transition.

**Steps to fix:**

1. Edit the workflow JSON.
2. Add a trigger specifically for the transition into your final state.
3. Ensure the `event` matches the transition or state change that leads to the final state:
  1. Use `"event": "on-change-state"` to publish as soon as the page enters the state (regardless of whether it arrived via approval, button transition, or manual override).
  2. Only use `"event": "on-approve"` if the state itself includes an active approval step.

**Example Configuration:**

```
"triggers":
[
	{"event": "on-change-state",
	"conditions": [
      {
        "state": {
          "operator": "equals",
          "value": [
            "In Progress"
          ]
        }
      }
    ],
	"actions":
	[
		{"action": "publish-page"}
	]}
]
```

*Note: While documentation may warn about "duplicate publishing" when adding a trigger to the final state, in this specific scenario, the trigger is required because the automatic behavior has been suppressed by the presence of other triggers.*

---

## Related Diagnostics

If the page still fails to publish after verifying the workflow mode:

1. **Inspect workflow definition first:** If the page reaches the final state and Page Analysis passes all checks with no errors, inspect the workflow JSON for any occurrence of `publish-page` across all trigger blocks.
2. **[Check app permissions](https://support.appfire.com/space/CPCL/1328480358/Publishing+settings+and+permissions#Publishing-permissions)****:** Ensure the `Comala Publishing` app add-on user or the publishing user has **View**, **Add**, and **Delete** permissions in the **Target Space**.
3. **[Page analysis diagnostic tool](https://support.appfire.com/space/CPCL/953516116/Page+analysis+diagnostic+tool)****:** On the affected source page, go to **... -> Page Analysis**. Check the **Diagnostics** tab for errors related to space connectivity or permission blocks.