Overview
Panel | ||
---|---|---|
| ||
Publishing to a different space in a another instance in this example requires the installation and configuration of the Comala Remote Publishing app to set the target instance and target space for the publishing action. |
In this example we'll look at some advanced markup including customised approvals, queued actions, custom events and error handling.
Before you start
If you haven't already done so, please read remote-space publishing and complete the required configuration for both remote and local instances of Confluence.
Basic Markup
Here is the basic markup shown on theĀ remote-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 synchronisation fails
Adding the states
Here is the script from above, with the added "Synchronise" and "Error" states added. We've also updated the trigger to be activated by the Synchronise state rather than the Published state. Also, the Review will now transition to Synchronise state instead of Published when approved.
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} {remotepublish-page:remote} {trigger} {workflow} |
Improving the states
Currently the Synchronise state will show the default state selection drop-down, which isn't what we want. Let's hide thatĀ using the hideselection
parameter, and we'll also give the state a description
to explain what's going on to anyone who opens the Workflow Popup during synchronisation:
...
We also set the colour for the state to be red (#ff0000
).
Queued and custom triggers
Complex content might take a few moments to publish, espeically if an entire page hierarchy is being published at the same time. So we'll queue
the actions in the trigger.
...
Code Block | ||
---|---|---|
| ||
{trigger:statechanged|state=Synchronise|queue=true|newevent=AfterSync} {remotepublish-page:remote} {trigger} {trigger:AfterSync|success=true} {set-message:style=success|duration=PT1M} Remote publishing complete! {set-message} {set-state:Published|comment=Remote publishing complete} {trigger} {trigger:AfterSync|success=false} {set-message:style=error} Remote publishing failed. @errormessage@ {set-messsage} {set-state:Error|comment=Remote publishing failed} {trigger} |
Putting it all together
Here's the finished workflow:
...