Different events can be used to increment a composite version number using the increment-metadata
You can add a condition to a trigger to increment one element of a composite version.
In this approval workflow the approver in the Review state chooses the element of the composite version update being approved.
- the composite version number is set as a metadata value of 1.0.0 for
@current-version@on the page creation using the set-metadata macro
- a workflow parameter Update type
- the content review approve decision requires the setting of the Update type workflow parameter value prior to the approved transition
- the required parameter value is one of Major, Minor or Patch selected from an option list
- the choice of Major, Minor or Patch parameter value acts as a condition for one of three triggers to update the appropriate metadata version component of
@current-version@using the increment-metadata macro
The example only works when the workflow is applied as a space workflow on creation of a page. The space workflow must be active to listen for the
pagecreated event to initialize the metadata value. The
pagecreated event trigger will not fire if the workflow is applied to existing content and the metadata value will not be initialized.
Use of triggers
The workflow uses the following trigger actions
pagecreatedevent trigger initializes a version value using set-metadata macro on the creation of the page
pageapprovedevent triggers increment the component version value using the increment-metadata macro. Each trigger updates a different element of the composite metadata version number
a statechangedevent trigger clears any existing value for the
@Update type@workflow parameter on a transition to the Review state
Each of the three
pageapproved event triggers listen for the approval decision for the Approved content review in the Review state. But each trigger has a condition based on the type of version update set by the approver.
- the condition is the value of the workflow parameter Update type=Major or =Minor or =Patch
Metadata values are also updated in each of these three triggers for the following
These are displayed on the content using the pageheader macro.
You may need to refresh the page content to view changes in the displayed metadata values.
Workflow parameter value trigger condition
Major, Minor and Patch are workflow parameter values set as a list option choice for the workflow parameter
In the workflow popup, the reviewer is required to set this parameter value for the approve decision to take place.
The approver chooses one of Major, Minor or Patch values from the parameter value option.
Once confirmed the approved transition occurs.
Composite major-minor-patch version workflow
Only works if this example workflow is applied as a space workflow.
Here's how each trigger action works
|Trigger Event||Action macro(s)||Notes|
Only the approved transition to the Approved state will update the metadata version in this example.