This site has moved to the integrated Appfire documentation and information site for our apps.

From February 2024 this site is no longer updated.

Take a look here! If you have any questions please email support@appfire.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Scenario

I would like to display the approved version page number followed by the draft version page number.

Solution

You can do this by using Comala Document Management and macros installed with the app. The macros

The current version for the page, whether in the workflow draft or approved state is the Confluence page version listed in the page tools menu option Page History

  • this is stored as a Confluence metadata data and can be accessed by retrieving the current value using the value reference @version@

We can use this together with the set-metadata macro to store the page version when the content is approved.

You can then use the get-metadata macro to retrieve this version value.

Store the approved version

Simply add the following workflow trigger to your Comalatech workflow

{trigger:pageapproved|approval=ApprovalName}
	{set-metadata:approvedversion}@version@{set-metadata}  
{trigger}

This sets a workflow trigger to listen for a pageapproved event for the content review named ApprovalName.

In our simple workflow, this content review is in the Draft state.

The Confluence content version created when the page is approved will be stored as a value for the metadata named approvedversion.

This will change every time the page is approved if the content has been edited and the Confluence version has changed.

Retrieve and display the draft and approved versions on your page

We have two metadata values

  • the current version is the value for the Confluence metadata version
  • the version when the last pageapproved event occurred stored as the value for the metadata approvedversion

We can retrieve these metadata values using the value references @version@ and @approvedversion@ using the get-metadata macro.

You can then display the draft version and the approved version in the pageheader macro.

{pageheader:visibility=all}
	|Approved version:{get-metadata:approvedversion}| Draft revision:{get-metadata:version}|
{pageheader}

In workflow builder, you can simply add the wiki markup to the Page Header option.


The content will display the draft and the approved versions in a simple table.

Here the latest version is the last approved version. Content is in our simple workflow Approved state.



The Approved state is the final state in our workflow and we have configured the workflow so that if the content is updated the workflow transitions to the Draft state.

Each saved update will change the displayed current version value.


The approved version changes only on the pageapproved event, setting a new value for the metadata approvedversion. In our workflow, this also actions a transition to the Approved state.



(info) The pipes "|" in the markup create the table on the page

Displaying versions in a published space

You can use the Comala Publishing app to publish your content in a target space (different-space publishing)

In the draft space, you can add the publish-page macro to the pageapproved trigger.

{trigger:pageapproved|approval=ApprovalName}
	{set-metadata:approvedversion}@version@{set-metadata}  
	{publish-page}
{trigger}


To copy the draft space page approvedversion metadata to the published (target) space, you will need to

  • check Page Properties checkbox in the Comala Publishing Options screen in Space Tools>Publishing Configuration

Lastly, to show pageheader in the Published space, you need to add the following workflow to the published space

{workflow:name=Published Space Header|hideStates=true}
    {description}
        This is the workflow for the published space to show metadata from the draft space
    {description}
    {pageheader:visibility=all}
        ||Version: {get-metadata:approvedversion}|
        {pageactivity}
    {pageheader}
    {state:invisible|final=true}
    {state}
{workflow}


You can also use the increment-metadata macro to create composite versions for your content. The increment-metadata macro can be used in a workflow trigger and be configured to increment a version value (including options to increment the major, minor and/or patch value of a composite version value).

Related pages

Further reading




  • No labels