Different events can be used to increment a composite version number.

The workflow uses the following trigger actions

  • initialize a metadata version value using set-metadata macro
  • increment the metadata version value using the increment-metadata macro using different triggers for each element of a composite version number

You will need to refresh the page content to view changes in the metadata value if you use the get-metadata macro on the page to display the metadata value.

(blue star) These examples only work when the workflow is applied as a space workflow. The space workflow must be active to listen for the pagecreated event to initialize the metadata value. 

Composite major-minor version content

{workflow:name=Increment a Metadata Version 1}
        A simple approval workflow with use of increment-metadata macro to set the major and minor versions. Major version incremented on approval of content, minor version on any update on the approved content
        ||Type|| Version||Version Number||
        |Page metadata|content-version value|@currentversion@|
        |Confluence metadata|Confluence version value|@version@|

(star) In our example, applying the space workflow to existing pages will not initialize the currentversion metadata value and subsequent use of the currentversion metadata in the increment-metadata macro will not work. 

(info) The get-metadata macro can be added to a page to retrieve and display the current metadata values.

Here's how each trigger action works. 

Trigger EventAction macroNotesConfluence and Metadata version displayed on content using get-metadata macro

  •  sets the metadata content-version and initializes the value to 0.1 on the creation of the page
  • only works if the workflow is applied as a space workflow on creation of the page

Editing content in the Initial state updates the Confluence version value but not our metadata value.

(star) Applying this workflow in ‘page mode’, the pagecreated trigger will never fire because the page is created before the workflow is applied. The metadata value would need to be initialized using a different event trigger.

  • increments the metadata content-version minor value by 1 on the transition to the Review state

  • increments the content-version major value by 1 each time the content is approved and transitions to Approved
  • minor value is reset to zero

Editing content in the Approved state

  • transitions the updated content to the Review state
  • the statechanged trigger increments the minor value of the content-version metadata

An individual reviewer rejection decision on its own does not impact the metadata content-version value. 

The metadata value is linked to a page not a Confluence page version so when viewing a previous page version this will show the current metadata value.

For example, viewing the final Approved state content whilst content is in a draft state would display the current metadata value NOT the metadata value when the content was published.

Content in draft stateContent in published state

Edit the Approved state, content updates and transitions to draft state Review.

The displayed metadata would be

  • current Confluence version 
  • incremented page metadata content version value

Content in Approved state prior to editing. Using get-metadata page will display

  • previous Confluence version
  • but the current page metadata content-version value that was incremented on the last transition to the draft state Review

Manage composite major-minor-patch version of the content

Additional triggers may be useful to initiate major-minor-patch value changes.

This second example below uses an increment-metadata macro to support the custom versioning of a page using a composite numeric metadata value.

The elements of the composite version are incremented when different specific events occur.

{workflow:name=Composite Increment Metadata}

(star) Only works if this example workflow is applied as a space workflow.

The metadata name and initial value are set on the creation of the page using a trigger macro and the set-metadata action macro.


A version change will occur:

  • for every page edit (a PATCH version change)
  • on a state change to the Review state(a MINOR version change).
  • on a state change to the Approved state (a MAJOR version change).

Metadata value initialization

Page creation creates the metadata comp-version and sets the initial value as 0.0.1

{set-metadata:comp-version} 0.0.1 {set-metadata}

Minor element value update

A state change to the Review state will update the second numeric element (MINOR element)of the version by  1.

The workflow uses a trigger macro on the statechanged event for state=Review and the increment-metadata action macro.


This also resets the final numeric element to zero e.g. a version value 2.1.3 will change to 2.2.0.

Major element value update

A state change to the Approved state will update the first numeric element (MAJOR element) of the version by  1

The workflow uses a trigger macro on the statechanged event for state=Approved and the increment-metadata action macro.


This also resets the second numeric element and the final numeric element to zero e.g. version 2.2.5 will change to 3.0.0.

Patch element value update

A page edit will increase the final numeric element (PATCH element)of the version using a trigger macro on the pageupdated event and the increment-metadata action macro.


The final numeric element of the version will increment by 1 for a page edit in any of the workflow states.

Related examples