Overview
As a Confluence user, you will be familiar with the concept of labels as a method of folksonomy, but they can also be integrated with your workflows in order to
Automatically apply workflows
Enable or disable workflow functions
Add or remove labels in response to Events
Perform Actions when labels are added or removed
Make labels "sticky", which prevents their removal
Ensure compliance with content labelling policy
Automatic workflow application
To use this feature, the workflow must be added and enabled in the space document management dashboard (the workflow is applied in space mode).
Use the label
and, optionally, invertlabel
parameters of the workflow macro to specify which labels the workflow should or should not be applied to.
{workflow:name=Apply by label|label=test,testing} {state:Test works} {state} {workflow}
In this example, the workflow, when applied in space mode, will automatically be assigned to any content with the label
test and/or testing.
If you added the invertlabel=true
parameter, it would be automatically applied to any content that does not have either of the labels test or testing.
In the space document management dashboard, you can use the workflow builder visual editor to add one or label content filters to a space workflow.
This workflow will be applied automatically to any content with the label hr_kpi and/or hr_obj.
Check the Invert labels option to automatically apply to any content that does not have either of the labels hr_kpi or hr_obj.
Label filters added to a workflow are displayed in the workflow listing in the document management dashboard.
The Human Resources Team kpi and objectives workflow will be applied to documents in the space that have either the hr_kpi or the hr_obj label added.
When using content labels to apply workflows across space content, all enabled workflows in the space must use a content label filter otherwise an enabled workflow in the space without a content label filter will take priority and be applied.
Enable or disable workflow features
Any macro which supports conditions can be disabled or deactivated by the haslabel
condition.
For example, you can disable state selection or reviews if labels are missing:
{workflow:name=Disable review} {state:First} {state-selection:states=Second|haslabel=first} {state} {state:Second|approved=Third} {approval:Review|haslabel=!second} {state} {state:Third} {state} {workflow}
In this example:
Transition from
First
toSecond
state requires the content be labelled "first"The review in the
Second
state will be disabled if the content is labelled "second"
Macros which support conditions:
Conditions for an approval and the state selection transition can be added using the workflow builder visual editor.
Select transition
One or more conditions can be included when adding a select transition for a state in the workflow builder visual editor.
The select transition is not active on the page in the workflow popup if the label review has not been added to the page.
Adding the label review to the page meets the select transition condition and the workflow popup displays the select transition option.
A condition cannot be added to an existing select transition in a workflow in the workflow builder visual editor. You must either remove the select transition and then add again with the required condition or add the condition using the markup editor. Adding the condition in the markup editor updates the select transition in the workflow builder visual editor.
Approval
One or more conditions can be added to an approval in the workflow builder visual editor.
The added haslabel condition for the label review has the Invert option checked. The Review approval in the Review state is only active on the page in the workflow popup if the label review is not on the page.
Both the Approved and Rejected buttons are disabled in the workflow popup.
Removing the label from the page enables the Approved and Rejected buttons.
Adding and removing labels
You can use Events to Trigger the Actions which can add or remove labels.
{workflow:name=Add or remove label} {state:First} {state} {state:Second} {state} {trigger:statechanged|state=First} {set-label:First} {remove-label:Second} {trigger} {trigger:statechanged|state=Second} {set-label:Second} {remove-label:First} {trigger} {workflow}
In this example:
Entering the
First
state will add "first" and remove "second" labelsEntering the
Second
state will add "second" and remove "first" labels
Note: The label changes will take effect as soon as you transition between the states, but you'll need to refresh the page to update the on-screen list of labels for that page.
Action macros:
-
remove-label macro — Remove a label from the content
-
set-label macro — Add a label to the content
-
Trigger actions when labels change
When labels are added or removed from a page, the labeladded
or labelremoved
Events are sent. Triggers listening for those events can determine which label was added or removed via the @label@
, @addedlabel@
or @removedlabel@
Event references.
Value references
You can access extensive information about content labels by accessing the Label Supplier via a Supplier Reference (requires ServiceRocket Reporting for Confluence app).
Sticky labels
You can prevent labels from being removed (but admins can still remove them) by using the stickylabels
parameter on the workflow macro.
One or more “sticky labels” can be added for a workflow using the workflow builder visual editor.
Content labelling compliance
In situations where business or regulatory compliance mandates a content labelling policy, you can enforce that via the workflow.
If all documents (pages) relating to a specific regulation must be labelled, you can either make the workflow add those labels, or require that content be labelled in order for the workflow to be automatically applied.
Our existing customers use the workflow-instructions macro to convey content labelling policy to content producers at the point of initial content creation.
Workflow instructions can be added to a workflow using the Workflow Instructions option in Page Layout in workflow builder visual editor.
Macros
-
approval macro — Add content-focus reviews to states
-
remove-label macro — Remove a label from the content
-
set-label macro — Add a label to the content
-
state-selection macro — Specify direct state transitions
-
trigger macro — Trigger actions when events are fired
-
workflow macro — Defines a workflow tempalte
-
Events
Label changes will generate Events, which can be used to Trigger Actions:
labeladded
labelremoved
Value references
Information about labels can be obtained from Value References:
Examples
See also
Atlassian Marketplace: