Overview
Panel | ||
---|---|---|
| ||
Publishing to a different space in the same instance in this example requires the installation and configuration of the Comala Publishing app to set a target space for the publishing action using the publish-page macro. |
In this example, we'll look at some advanced markup including customized approvals, queued actions, custom events, and error handling.
Before you start
If you haven't already done so, please read different-space publishing and complete the required Comala Publishing space configuration for the local instance of Confluence.
Basic Markup
Here is the basic markup from the different-space publishing page.
...
Add a new Synchronise state which will trigger the publishing process
Add some custom events to handle success and failure scenarios
Add an Error state to decide what happens if synchronization fails
Adding the states
Here is the markup from above, with the added states Synchronise and Error.
...
Code Block | ||
---|---|---|
| ||
{workflow:name=Different-space Publishing} {state:Editing|submit=Review} {state} {state:Review|approved=Synchronise|rejected=Editing} {approval:Review|assignable=true} {state} {state:Synchronise} {state} {state:Error} {error} {state:Published|final=true|updated=Editing} {state} {trigger:statechanged|state=Synchronise} {publish-page} {trigger} {workflow} |
Improving the states
Currently, the Synchronise state will show the default state selection drop-down, which isn't what we want.
...
Code Block |
---|
{state:Error|colour=#ff0000|approved=Synchronise|rejected=Published|hidefrompath=true|description=Synchronization failed, what do you want to do?} {approval:Error|approvelabel=Retry|rejectlabel=Ignore} {state} |
Queued and custom triggers
Complex content might take a few moments to synchronize, especially if an entire page hierarchy is being published at the same time.
...
Code Block | ||
---|---|---|
| ||
{trigger:statechanged|state=Synchronise|queue=true|newevent=AfterSync} {publish-page} {trigger} {trigger:AfterSync|success=true} {set-message:style=success|duration=PT1M} Synchronisation complete, content is published! {set-message} {set-state:Published|comment=Synchronization completed successfully} {trigger} {trigger:AfterSync|success=false} {set-message:style=error} Synchronization failed. @errormessage@ {set-message} {set-state:Error|comment=Synchronization failed} {trigger} |
Putting it all together
Here's the finished workflow.
Code Block | ||
---|---|---|
| ||
{workflow:name=Different-space Publishing} {state:Editing|submit=Review} {state} {state:Review|approved=Synchronise|rejected=Editing} {approval:Review|assignable=true} {state} {state:Synchronise|hideselection=true|description=Content synchronisation in progress, please wait...} {state} {state:Error|colour=#ff0000|approved=Synchronise|rejected=Published|hidefrompath=true|description=Synchronization failed, what do you want to do?} {approval:Error|approvelabel=Retry|rejectlabel=Ignore} {state} {state:Published|final=true|updated=Editing} {state} {trigger:pageapproved|approval=Review} {set-message} Synchronising content... {set-message} {trigger} {trigger:statechanged|state=Synchronise|queue=true|newevent=AfterSync} {publish-page} {trigger} {trigger:AfterSync|success=true} {set-message:style=success|duration=PT1M} Synchronisation complete, content is published! {set-message} {set-state:Published|comment=Synchronization completed successfully} {trigger} {trigger:AfterSync|success=false} {set-message:style=error} Synchronization failed. @errormessage@ {set-message} {set-state:Error|comment=Synchronization failed} {trigger} {workflow} |
Related pages
...