Conditions in Confluence automation

Automation is an admin feature available in Confluence Premium and Enterprise.

Conditions are optional components that limit the scope of your rule.

The conditions that you specify must be met (that is, “pass”) in order for the rule to continue running.

For example, let's imagine your rule is set to trigger when a new page is published. You could add a User condition so the rule only runs if the page was published by a specific person.

As you build more complex rules, you might add conditions at more than one point in your rule summary. Each condition only impacts what comes after it. If a condition isn’t met, the actions that follow it won’t be performed.

Confluence conditions

These conditions are specific to automation for Confluence and can be used to automate a single space (Space automation) or multiple spaces at once (Global automation).

User

If you add a User condition, your rule only runs when it’s triggered by certain users or groups.

For example, let's imagine your rule is set to trigger when a new page is published. You could add a User condition so the rule only runs if the page was published by a specific person.

If you add more than one user or group in the same field, the rule will execute when it’s triggered by any one of them (that is, if the user is Person 1 OR Person 2 OR Person 3).

 

CQL

If you add a CQL condition, your rule only runs when the trigger meets parameters you define in a query (using Confluence Querying Language [CQL]).

Like JQL and IQL in Jira, CQL can be used to conduct advanced searches in Confluence.

The CQL condition is a way to create a custom condition using any object type that you want.

Create custom queries

A simple query in CQL (also known as a 'clause') consists of a field, followed by an operator, followed by one or more values or functions.

For example, the following simple query will find all content in the "TEST" space. It uses the Space field, the EQUALS operator, and a text value term ("Test".) CQL terms are not case sensitive.

1 space = "TEST"

You can join two or more clauses with keywords (like OR, AND) to form a more complex CQL query.

Below are some examples of common CQL queries to provide contextual starting points for different objects. To learn more about how to construct your own queries, see Advanced searching using CQL.

 

Query examples (by object type)

If the page…
  • …contains a term (or phrase) in the title

    1 title ~ "meeting minutes"
  • …uses a specific Confluence macro

    1 type = Page AND macro = cqlnavigation

     

If the blog post…
  • …was created in the last month

    1 type = blogpost AND created > startOfMonth("-1M") AND created < startOfMonth()

 

If the comment…
  • …was written by you (as a specific user) in the past week

    1 type = comment AND creator = currentUser() AND created > startOfDay("-1w") order by created desc

     

If the attachment…
  • …contains a term (or phrase) in its name

    1 type = Attachment AND title ~ "screenshot"
  • …is a PDF that contains a term (or phrase)

    1 type = attachment AND title ~ "pdf" AND text ~ "confluence"

Atlassian Intelligence (AI)

If you add an AI condition, your rule only runs when the trigger’s field relates to a phrase you provide. This condition always pulls from the current state of the {{content}} smart value and can act on its body or title.

For example, if your rule is set to trigger when a new page is published, you could add an AI condition so the rule only runs if the page’s body relates to “meeting notes”.

If your admin disables AI, any rules with this condition will fail.

The consistency and accuracy of AI-based decisions may vary.

General conditions

If you’ve used automation for Jira, you’ll recognize some of the same general conditions like Advanced compare. You’ll configure them in a similar way, but they won’t currently function across products. This is on our roadmap.

{{smart values}} condition

This condition is considered advanced because it requires the use of Confluence smart values or regular expressions.

If you add a {{smart values}} condition, your rule only runs when it’s triggered by a certain state as defined by comparing either a smart value or a regular expression in the first field – to criteria you define in the second field.

You’ll use the center dropdown to specify the requirement of the criteria.

The {{smart values}} condition is a way to create a custom condition using dynamic variables.

 

If/else block

The If/else block component is an exception. It isn’t a condition – it's a way to define a choice of two conditions at the same point in your rule chain. By splitting the path into two “if/else” conditions, the rule can lead to one of two different outcomes.

It’s a little like “choose your own adventure” or a fork in the road: IF this condition is met, this sequence runs. Or ELSE the other condition is met and the other sequence runs. (If neither condition is met, the rule won’t continue running.)

The If/else block condition isn’t compatible with branch components.

While they both split the path of a rule, they serve opposing functions: An If/else condition runs either one path or the other, where as branching runs multiple paths at once.

You therefore won’t see If/else block as an option when you add a condition to a branch.

 

Additional Help