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:
Audit log:
Branch 2:
Notification email:
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!
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:
To explain it, I will show a starting point for your rule:
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}}~~
{{/}}
{{/}}
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:
{{#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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.