Using set-message and metadata to display different information for the draft and published content
If you want to show different versions of metadata depending on if your users are viewing the draft or published versions when using same-space publishing you can use the view
parameter of the set-message macro together with a metadata variable.
The value of the metadata ReleaseVersion is set when the transition to the Approved state occurs using the set-metadata macro.
Workflow template
{workflow:name=Using set message published and draft view}
{description}
The Simple Approval Workflow
{description}
{state:In Progress|approved=Approved|taskable=true}
{approval:Review|assignable=true}
{state}
{state:Approved|final=true|updated=In Progress|hideselection=true}
{state}
{trigger:statechanged|state=Approved}
{set-metadata:ReleasedVersion}@version@{set-metadata}
{set-message:view=published}
Published view
||Released Version |{get-metadata:ReleasedVersion}|
{set-message}
{set-message:view=draft}
Editor view
||Released Version|{get-metadata:ReleasedVersion}|
{set-message}
{trigger}
{trigger:statechanged|state=In Progress}
{set-message:view=draft}
Draft view
||Version |{get-metadata:version}|
{set-message}
{trigger}
{workflow}
Related Pages
First trigger
The published content displays the view=published
message on the public URL for the content
<hostname>/display/public/<spacekey>/<pagename>
A user with edit permission viewing content in the Approved state, by default, does not see the public URL content.
To avoid this confusion, the first trigger has a second set-message
action to cater to this scenario so that a user with edit permission sees a message in the Approved state.
Second trigger
The draft content displays the view=draft
message.