I'm trying to use Confluence automation to check for pages in my Space that have not been updated recently, and add the {{page.title}} to another page in the same Space in order to create a single page that is a report of pages that need to be reviewed.
I branch on inactive pages, then within the branch I check if the page status is 'Verified' and if it contains a specific label. Then I use the Edit page action to modify a specific page with the title "Pages to be reviewed" and append the URL and title of the page that needs review using smart values.
It actually seems to work however, it sends me an email and there is an error in the audit log saying "Failed to save edited page."
Hi @Mike Jones -- Welcome to the Atlassian Community!
Without seeing the specifics of your rule and the audit log details...
I hypothesize that because the rule branches over multiple pages and tries updating the same, specific page repeatedly, the updates are colliding and eventually causing an error. (Branches over more than one thing run in parallel and asynchronously.)
And so possible workarounds instead of branching would be:
Kind regards,
Bill
Hi Bill - thanks. That was the missing piece of information for me (branches are async and parallel). Totally makes sense that it errors out. I will research Lookup Pages to see if that option will work
Cheers,
Mike J.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok - I am very close. My automation looks like:
"Then: Lookup pages" has a criteria of Last updated more than 1 days ago.
So on my Edit page action, I can loop over the pages and add titles, but I can't seem to get it to only add the page details if the page contains a specific label. So far I have tried:
{{#lookupPages}}
{{#if(labels.contains("name=custom,"))}}
* GOT ONE: {{title}} was last modified: {{dateLastUpdated.format("yyyy-MM-dd HH:mm")}}
{{/if(labels.contains("name=custom,"))}}
{{/lookupPages}}
I have also tried variations on this.
{{#if(labels.match(".*name=custom.*"))}}
{{#if(labels.toString.match(".*name=custom.*"))}}
{{#if(labels.toString.contains("custom"))}}
{{#if(labels.contains("custom"))}}
None of these work either. the toString - seems to return an empty string.
If I loop over {{#labels}}, and then test for name.equals("custom" ) I can get it to match, but inside the #labels loop I've lost access to the page properties e.g., title and dateLastUpdated... as they are not in scope.
Is there a correct way to format the if statement so that it will check for my "custom" label?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did manage to get it to work if I do:
{{#if(labels.name.get(0).equals("custom"))}}
But that only works if the label is the first one in the list...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First thing: well done on the progress you made solving this!
With conditional list filtering, we can filter at different scopes. And as you discovered, filtering inside of the {{#labels}}...{{/}} nested, long-format iteration conceals data from the higher, pages scope. (This is a known limitation the automation team has not solved for several years.)
We can workaround this using inline iteration over the labels' name attribute and then filtering with match(), and finally using the result set count as the condition:
{{#lookupPages}}
{{#if(labels.name.match("(custom.*)").size.gt(0))}}
* GOT ONE: {{title}} was last modified: {{dateLastUpdated.format("yyyy-MM-dd HH:mm")}}
{{/}}
{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.