Conditions in Confluence automation

Automation is 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)

An Atlassian Intelligence condition lets you trigger your rule only when the trigger 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”.

Atlassian Intelligence is available and automatically activated for all products on Premium and Enterprise plans. Organization admins can manage Atlassian Intelligence preferences from Settings > Atlassian Intelligence in Atlassian Administration.

If your admin turns off Atlassian Intelligence, any rules using AI components will not run.

For more on how Atlassian Intelligence works, its limitations, and our commitment to privacy, visit the Atlassian Trust Center.

Analytics

Analytics conditions let you set one or more criteria to control whether or not a rule will be triggered.

Page condition

The page condition will compare a value against a specified page statistic.

Select up to five criteria, linked with AND/OR logic.

The criteria for the condition include:

  • Total views: equal to, less than, or more than a specified number

  • Total edits: equal to, less than, or more than a specified number

  • Total comments: equal to, less than, or more than a specified number

  • Page title: contains or doesn’t contain a specified text string

  • Labels: Contains or doesn’t contain one or more specified label

  • Status: Page status is one of the statuses configured for the page’s space

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.

 

Still need help?

The Atlassian Community is here for you.