Going Stellar

Home/CQL reference

CQL field

watcher in CQL (Confluence): syntax and examples

The watcher field finds content that a given user watches. Use it to see what will end up in your notifications, or to find watched pages that have gone stale. With currentUser() it works as a personal filter.

Syntax

watcher = currentUser()
watcher = "<accountId>"
watcher != currentUser()

Arguments

ArgumentWhat it does
valueAn accountId in quotes, or the function currentUser(). The docs say you search by accountId.

Works with

  • Operators: =, !=, IN, NOT IN (~, !~, >, >=, <, <= are rejected)
  • Functions: currentUser()
  • Not with: ~, !~, >, >=, <, <=

Examples

watcher = currentUser() AND type = page AND ancestor = 32964613 AND title ~ "policy"

Lists the policy pages under a handbook that you watch.

Run on Confluence Cloud on .

watcher = currentUser() AND type = page AND lastmodified < now("-4w") ORDER BY lastmodified ASC

Finds watched pages that have been quiet for a month, oldest first, so you can unwatch the dead ones.

Run on Confluence Cloud on .

watcher = currentUser() AND type = page AND space = SD AND NOT ancestor = 32964613

Shows watched pages in a space outside one section.

Run on Confluence Cloud on .

watcher = currentUser() AND ancestor = 32964613

Checks which items in a handbook tree send you notifications.

Run on Confluence Cloud on .

watcher = "99:27935d01-XXXX-XXXX-XXXX-a9b8d3b2ae2e"

Looks up what one person watches, using an accountId.

Run on Confluence Cloud on .

Pitfalls

  • watcher in (currentUser()) runs too. A list such as watcher in (currentUser(), "99:27935d01-XXXX-XXXX-XXXX-a9b8d3b2ae2e") is the way to cover a small team in one clause.
  • The docs say you search watchers by accountId, not by name. Take the accountId from the user's profile instead of trying a name sub-field.
  • watcher != currentUser() is everything you do not watch, not what others watch. It is a large set, so narrow it with space and type.
  • A query for another person's accountId runs without an error even if it finds nothing, so an empty result does not prove that the person watches nothing.

Sources

  1. CQL fields (Atlassian Developer, Confluence Cloud)

Markdown version · All CQL pages