Overview
This example shows a little trick for preventing a content review if there are any outstanding workflow tasks.
You must install the Reporting for Confluence app in addition to Comala Workflows.
Example
It's achieved using a condition on the {approval}
macro:
{workflow:name=Complete the tasks} {state:Editing|submit=Review} {state} {state:Review|approved=Done|rejected=Editing} {task:Complete this to review} {approval:Review|assignable=true|@workflow:tasks > size@=0} {state} {state:Done} {state} {workflow}
When this workflow reaches the Review state, a single task is added. Only once that task is complete can reviewers Approve or Reject the content.
Note: People can still be assigned to the review even if there are tasks, but they cannot Approve or Reject until the tasks are complete.
How it works
The {approval}
uses a Value Reference Condition which checks the number of tasks by querying the Workflow Supplier. If there are no tasks, the condition is met, and the review will be enabled.
Let's take a look at the condition:
@workflow:tasks > size@=0
Here's how that works:
- The content between the two
@
symbols is a Value Reference. - The
workflow:
indicates we are querying the Workflow Supplier - The
tasks
indicates we want to access the tasks object within the supplier – it provides information about all the tasks on the current page or blog post - The
>
indicates we want to query an attribute on thetasks
object, in this case thesize
attribute which tells us how many tasks there are - We then equate that to a number, in this case
0
We could set it up so that the review is only enabled if there are one or more tasks by changing the condition to:
@workflow:tasks > size@=!0
Adding the exclamation mark means "not", so this condition is requiring that "number of tasks is not zero".