Branches in Confluence automation

Automation is a new admin feature available in Confluence Premium and Enterprise. Read the announcement in this community post to learn more.

Branches are optional components that expand the execution of your rule. When a branch is added, the rule no longer executes in a linear fashion, but instead expands to multiple paths (with the potential to perform multiple actions).

After you add a branch, you’ll always be prompted to add a condition or an action next. (You can’t add another branch because branches don’t nest.)

The condition or action you add will only apply to the branched part of the rule chain.

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

This is because they serve opposing functions: An If/else block 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 component to a branch.

Confluence branches

In Confluence automation, a branch is always some form of “For each” plus a type of object. A For each branch applies whatever condition or action follows it, for each object type that meets the criteria you set.

For example, apply the same action for each task (the object type) that is due in 3 days (the criteria you set).

For each task

Tasks are action items that have been assigned to a person or team by mentioning them.

A For each task branch applies the same condition or action, for each task that meets the criteria that you set.

The scope of a For each task branch will look at all tasks in the associated space (Space automation) or spaces (Global automation).

For this reason, it’s commonly used to run space-level task audits in combination with the Scheduled trigger – as demonstrated in the rule template, Remind users of incomplete tasks that are due soon.

The criteria you can set includes:

  • Status: Whether the status of the task is complete or incomplete.

  • Due date: When the due date is (and whether it has passed).

  • Assignee: Who (or what group) the task is assigned to.

For each task will default to the Status criteria module. Select the X to remove it. Select Add Filter to add different (or additional) criteria including Assignee or Due date.

CQL stands for Confluence Querying Language and, like JQL and IQL in Jira, can be used to conduct advanced searches in Confluence.

A For each CQL result branch applies whatever condition or action follows it, for each object as defined by your query.

This is a way to create a custom “For each” branch 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)

For each page…
  • …that contains the same term (or phrase) in the title

    1 title ~ "meeting minutes"
  • …that uses the same Confluence macro

    1 type = Page AND macro = cqlnavigation


For each blog post…
  • …that was created in the last month

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


For each comment…
  • …that you (as a specific user) wrote in the past week

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


For each attachment…
  • …that contains the same term (or phrase) in its name

    1 type = Attachment AND title ~ "screenshot"
  • …that’s a PDF containing a certain term (or phrase)

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


General branches

Confluence doesn’t have any general branch components in common with other products.

Additional Help