Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation That labels child pages

Todd Winton
Contributor
July 30, 2025

I have created automation that adds a label if the text of the page title contains Business Rules.  This works fine.  However, I would like for all child pages of that page to also get the same label.  I have not implemented yet as the CQL says this will apply to all pages in the space, so want to avoid that.  Here is what I have.  Should this work?

Confluence Automation.png

1 answer

0 votes
Aron Gombas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2025

I think in the CQL you should use a clause like this:

ancestor = <the ID of the current page>

You should the corresponding smart value instead of my dummy placeholder, of course. It should give you the idea though.

That way, the query will return those descendants of the page that are not labeled with "business_rules".

Todd Winton
Contributor
July 31, 2025

So this space is a large space the contains page trees for each of our customers, approximately 200.  Each customer will have a parent page that contains Business Rules in the title.  I would like to have this apply to existing child pages of the business rules parent page.  In your suggestion you reference a specific page ID.  Does that work for my use case?

Aron Gombas _Midori_
Community Champion
August 1, 2025

Yes.

Because your automation rule will be triggered by one concrete "Business Rules" page, the rule will receive the ID of that concrete page. If you use that ID in the CQL clause, then the CQL search result will include the descendants of "Business Rules" page.

Todd Winton
Contributor
August 1, 2025

So my challenge her is I have a page tree structure similar to:

  • Customer 1
    • Customer 1 Business Rules
      • Rule 1
      • Rule 2
      • ...
  • Customer 2
    • Customer 2 Business Rules
      • Rule 1
      • Rules 2
      • ...

and so on

How would we apply something like this in this case?

Aron Gombas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2025

Roughly speaking, the automation rule should be built like this:

  1. use a trigger that will be called when labels on any page change
  2. use an "if" component that terminates the rule if its name doesn't end with "Business Rules"
  3. (at this point you have the ID of the page whose labels are changed and whose name ends with "Business Rules")
  4. run the CQL: 
    ancestor = {{page.id}}
  5. now you have all descendants
  6. add/remove the same label to each descendant

I hope this will give you the "inspiration".

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events