Conditions in Confluence automation

Status: Early Access **CLOSED to new participants**

Automation is available to a limited number of Confluence customers who signed up for early access. Sign-ups have closed, but watch for updates on the Automation community page.

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. They can be used to automate spaces (Space automation) and sites (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 it’s triggered by certain queries (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"

     

 

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.

Advanced compare

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

If you add an Advanced compare 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 Advanced compare 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