Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel2
minLevel2
absoluteUrltrue
excludeSee also
typeflat
separatorpipe

Overview

Excerpt
hiddentrue

Define pre-requisite conditions for transitions and triggers

Conditions allow you to specify additional prerequisite requirements for Triggers and some Transitions.

They are a set of optional parameters which can be added to the macros (listed below) to impose additional limits on when the macro will be active.

In addition, due to support for Value References, you can even create your own custom conditions by comparing metadata values.


Basic example

Code Block
languagetext
themeRDark
{workflow:name=Conditions}
   {state:Editing|approved=Done|rejected=Editing}
      {approval:Review|permission=administer|assignable=true}
   {state}
   {state:Done|final=true|updated=Editing}
   {state}
{workflow}

In the example above, only an administrator can review the content.

Compatible Macros

Note: If a macro has a parameter of the same name as a condition, the parameter – and documentation for that parameter on the macro page – takes precedence.

Content by Label
showLabelsfalse
max500
showSpacefalse
sorttitle
cqllabel = "supports-conditions" and label = "macro" and space = currentSpace()


Conditions

Condition

Value

Notes

Ver

Value Reference

A specific value, of valid type for the value reference.

Does the value of a value reference match the specified value?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label = "condition-value-reference" and space = currentSpace()


(warning) If used in a {trigger} macro that's listening to thepageupdatedevent, the trigger will not be activated if the referenced value is still being updated.
(warning)  One invalid parameter in a list of users in a conditionWILL disable the transition for the other listed users. The non-existent parameter is a blocker for an approval or a state-selection transition.

group

A comma-separated list of group names

Is the current user a member of one or more of the specified groups?


When applied to the {approval} macro it is an approval macro parameter. It is not used as a condition. It For example, you can prefix the list (not items in the list) with & (ampersand) to mandate that all users in the groups defined by the list must take part in the content review.

hasapproval

Name of an {approval}

Has an {approval} of the specified name been Approved for this content?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-hasapproval","condition-hasapproval") and space = currentSpace()


When applied to an {approval} macro in a {state} with multiple {approval} macros, this enables you to create nested approvals. Just make sure the {approval} you are referring to is defined prior to where the condition is used.

haslabel

A comma-separated list of content labels.

Does the content have one or more of the labels specified?


(info) ischildof

Title of required ancestor page.

Does the current page have a parent or ancestor page of the specified page title?


(info) ishomepage

  • true – Yes, it's the home page
  • false – No, some other page

Is this page set as the space home page?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-ishomepage","condition-ishomepage") and space = currentSpace()

See also: How to set space home page


isminorchange

  • true – Yes, the change was minor
  • false – No, watchers were notified

Did the content editor uncheck the "Notify watchers" checkbox (indicating a "minor change") before updating the content?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-isminorchange","condition-isminorchange") and space = currentSpace()


This condition can only be used on the {trigger} macro when listening to the pageupdated or newsupdated events.

(info) isorphan

  • true – Yes, the page is an orphan
  • false – No, the page has a parent page

Is the page an orphan (no parent page)?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-isorphan","condition-isorphan") and space = currentSpace()


(info) parenthaslabel

A comma-separated list of content labels.

Does the parent (or any ancestor pages) have one or more of the labels specified?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-parenthaslabel","condition-parenthaslabel") and space = currentSpace()


permission

  • edit – user can edit the content
  • view – user can view content
  • administer – user can administrate content

Does the user have the specified permission for the content?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-permission","condition-permission") and space = currentSpace()

See also: Roles and Permissions


† Irrespective of additional view restrictions resulting from Publishing

‡ Additional administrators can be defined via the adminusers parameter on the {workflow} macro.

space or spacekey

A space key.

Is the page or blog post in the space defined by the space key?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-space","parameter-spacekey","condition-space","condition-spacekey") and space = currentSpace()

Note: The space key is usually shown in URLs, or on the Space ToolsSpace Overview screen.


state

A {state} name.

Is the workflow for this content currently in the named {state}?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-state","condition-state") and space = currentSpace()


stateindraft

A {state} name.

Is there an unpublished version of this content in the corresponding Draft Space?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-stateindraft","condition-stateindraft") and space = currentSpace()


Note: This condition requires the Comala Publishing app to be installed.

title

Content title.

Does the content (page or blog post) have the specified title?

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-title","condition-title") and space = currentSpace()


user

Comma-separated list defining one or more users via their username or user groups.

Is the current user one of the users listed?

Note: You can include anonymous if you want to check for users who are not currently logged in to Confluence.

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label = "condition-user" and space = currentSpace()


When applied to the {approval} macro it is an approval macro parameter. It is not used as a condition. You can prefix the list (not items in the list) with & (ampersand) to mandate that all users in the groups defined by the list must take part in the content review.
usersdefinedComma-separated list of Value References

Does the value reference define users?

This is useful when using {workflowparameter} macro to create editable value references – you can check to see if the entered values are valid user accounts.

Content by Label
showLabelsfalse
max6
showSpacefalse
sorttitle
cqllabel = "example" and label = "concept-conditions" and label in ("parameter-usersdefined","condition-usersdefined") and space = currentSpace()

4.1

(info) – Denotes conditions which can only be used on pages, not blog posts.

† - Conditions are evaluated as AND conditions, with the exception of user and group. When both conditions are used, it's applied an OR clause i.e., (user or group) either one of those parameters is required for the condition to be true.

Negation

Conditions are compared to values. Values can optionally be negated with a ! (pling / exclamation mark) symbol:

Code Block
languageerl
themeRDark
{...|condition=value|...} -- value must match
{...|condition=a,b,c|...} -- one or more of the values must match
{...|condition=!value|...} -- value must not match
{...|condition=!a,b,c|...} -- none of the values must match

Invalid workflow parameter for a user
Anchor
invalidparameteruser
invalidparameteruser

One invalid parameter in a list of users in a condition WILL disable the transition for the other listed users. The non-existent parameter will act as a blocker for other users.

Table of Contents
maxLevel3
minLevel3

Invalid workflow parameter for a user in a condition for a select transition

If a workflow parameter is used to specify a user for a state-select transition the transition will be disabled If the user set in the parameter is invalid (deleted or non-existent).

The transition will become active if the parameter becomes valid by adding a valid value or is deleted.

For example if the workflow parameter @myParam@ has an invalid user value, the transition button in the workflow popup will be disabled.

Code Block
languagetext
themeRDark
{state:In Progress|taskable=true}
        {state-selection:states=Approved|user=@MyParam@}
{state}


If the invalid workflow parameter is one of a list of users for the state-select transition, the transition will be disabled for the other users listed in the condition. The non-existent parameter is a blocker for the transition.

Code Block
languagetext
themeRDark
{state:In Progress|taskable=true}
        {state-selection:states=Approved|user=@MyParam@, admin, elle}
{state}

An error is shown indicating that there is an error in the workflow definition regarding the list of users who can undertake the transition.

Invalid workflow parameter in a condition for an approval

If a workflow parameter is used to specify a single user for an approval, the Approve and Reject buttons in the workflow popup will be disabled if the user set in the parameter is invalid (deleted or non-existent).

Code Block
languagetext
themeRDark
{state:Review|approved=Approved|rejected=Rejected}
        {approval:Review the page|user=@MyParam@}
{state}

The transition will become active if the parameter becomes valid by adding a valid value or is deleted.


If the invalid parameter is one of a list of users for the approval then the approval is disabled for all users.

Code Block
languagetext
themeRDark
{state:Review|approved=Approved|rejected=Rejected}
        {approval:Review the page|assignable=true|user=@MyParam@, admin, elle}
{state}

The non-existent user defined in the parameter blocks the approval.

An error is shown indicating that there is an error in the workflow definition regarding the list of users who can approve.

The approval will become active for each defined user if the parameter becomes valid by adding a valid value or is deleted.

Examples

Content by Label
showLabelsfalse
max100
showSpacefalse
sorttitle
excerptTypesimple
cqllabel in ("concept-conditions","condition-group","condition-hasapproval","condition-haslabel","condition-ischildof","condition-ishomepage","condition-isminorchange","condition-isorphan","condition-parenthaslabel","condition-permission","condition-space","condition-spacekey","condition-state","condition-stateindraft","condition-title","condition-user","condition-usersdefined","condition-value-reference") and label = "example" and space = currentSpace()

See also

Workflow Authoring Guide: