Forums

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

Excluding page labels from automation email

erica_bogosian
Contributor
January 20, 2026

I've posted on this before, but for the past couple months I've been trying to set up a pair of automated rules that will a) notify users of inactive pages they own and then b) archive inactive pages a month later. While I've gotten the base functionality to work, where I'm running into trouble is excluding pages with a certain label. I'm at a point where while I can exclude pages from the first branch identifying inactive content, I can't duplicate that result in the second branch that sends a consolidated notification email to the owner. While I could send an individual email for each archived page, obviously that isn't ideal in large quantities. 

Branch 1: 

Screenshot 2026-01-20 100246.png

Audit log: 

Screenshot 2026-01-20 100304.png

Branch 2: 

Screenshot 2026-01-20 100318.png

Notification email: 

Screenshot 2026-01-20 100331.png

Notice that "egg" (my test page with one of the excluded labels) doesn't appear in the log but does appear in the notification. 

Any input on this is appreciated. Thank you!

1 answer

1 vote
Bill Sheboy
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 Champions.
January 20, 2026

Hi @erica_bogosian 

Short answer: The for-each-inactive-page is a special type of branch in Confluence rules, and thus solving your filtering scenario is not trivial.

 

For more details to explain, and my apologies this is so long...

While the first part / branch may be used like a normal branch over zero-to-many pages, using the second part / branch is creating a list, smart value for each one matching the criteria in the advanced branch, such as {{inactivePagesPerAuthor}}

Thus, when your second branch tried to filter using conditions, it encountered two problems:

  • The branch variable is ownerInactivePages, and that is not referenced in the Smart Value Conditions as a prefix.  As they are tested against {{page.labels.name}} that is always empty and so the conditions pass every time.
  • Because this second branch produces a list of matching pages, testing one single page will not work.  Instead...
    • List filtering is required to check if any pages for that Author were missing the label(s) before the attempted email
    • Then inside of the email, again use the list filtering to only send the desired pages.

 

To explain it, I will show a starting point for your rule:

  • trigger: scheduled
  • branch rule / for each inactive page:
    • nothing is really needed here...unless you want to include your condition and logging for testing purposes
  • advanced branch: Please note I added a prefix to the variable name to reduce the chance of errors and make it more visible.
    • variable name: varOwnerInactivePages
    • smart value: {{inactivePagesPerAuthor}}
      • smart values condition:
        • first value: 
          • {{#varOwnerInactivePages}}{{#if(and(labels.name.join(",").indexOf("auto-exempt").eq(-1),and(labels.name.join(",").indexOf("insight-").eq(-1)))}}{{title}}~~{{/}}{{/}}
        • condition: does not equal
        • second value: leave as Empty
      • action: create variable (to capture only one email address for the owner)
        • variable name: varOwnerEmails
        • smart value:
          • {{#varOwnerInactivePages}}{{#if(and(labels.name.join(",").indexOf("auto-exempt").eq(-1),and(labels.name.join(",").indexOf("insight-").eq(-1)))}}{{owner.emailAddress}}~~{{/}}{{/}}
      • action: send email
        • to address: {{varOwnerInactivePages.split("~~").first.trim}}
        • body:  use list filtering again to extract the desired fields

 

To explain the list filtering part, let's expand that first condition:

{{#varOwnerInactivePages}}
{{#if(and(labels.name.join(",").indexOf("auto-exempt").eq(-1),and(labels.name.join(",").indexOf("insight-").eq(-1)))}}
{{title}}~~
{{/}}
{{/}}
  • each pass through the advanced branch creates a new list in varOwnerInactivePages
  • we need to long-format iterate over that list
  • adding a list filter, we use to conditions on the labels with the and() function 
  • testing that your specific labels are not present using the indexOf() function 
  • early in the rule, we only care if anything was found, so I just combined the titles and we only proceed if anything was found
  • later, we used Create Variable to extract one email address for the owner
  • finally, the email can repeat the filtering in the email send

 

Note that filtering is repeated three times, which is a bit risky for maintenance.  An alternative is to filter one time, saving all the fields need in a single text variable with delimiters.  Then parse out what is needed later.  For example:

  • action: create variable
    • variable name: varFilteredPages
    • smart value:
{{#varOwnerInactivePages}}
{{#if(and(labels.name.join(",").indexOf("auto-exempt").eq(-1),and(labels.name.join(",").indexOf("insight-").eq(-1)))}}
OWNER_EMAIL:{{owner.emailAddress}};TITLE:{{title}};URL:{{url}};LASTUPDATED:{{dateLastUpdated}}~~
{{/}}
{{/}}

Then, split ~~ and then extract each value needed.  For example, to get one email address:

{{varFilteredPages.split("~~").first.trim.substringBetween("OWNER_EMAIL:", ";TITLE").trim}}

 

I recommend experimenting by not sending emails initially, and instead just write to the audit log until everything is working how you want.  You may repeatedly run the scheduled trigger rule from the editor until everything is ready.

 

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events