Use automation to a add label when a page is moved to a specific parent

Max Elfving _Ålander_ September 12, 2023

Hi!

I want to add a specific label to a Confluence page if it's moved TO a specific parent.

 

When: Page moved

If: space.key = 123 AND parent = 456

Then: Add label
label

 

This almost worked as intended. It added a label when a page was moved FROM the parent instead of TO the parent.

Does anyone know what I can do to fix that?

2 answers

0 votes
Ashok Rao December 18, 2024

Hi @Max Elfving _Ålander_ ,

I found this question because I was struggling with this exact same problem. The problem is indeed that you cannot configure where you move a page to, when the trigger is "When: Page moved". 

The solution I ended up using, is simply by reversing the question, and that got me where I wanted. It might not be exactly suitable for you, but I thought I would write it down anyway. 

What you're trying is: "When: page moved" then "add label". 

I changed the rule to:  "When: page labelled" then "Move Page". That allows you to configure where you move the page to. The difference is, of course, that you have to instruct your team exactly which labels to use in which circumstances. But honestly, I much prefer this, because it allows you to configure the exact destination of the page.

And there is an added benefit to this: that way, I can add a restriction to the space preventing anyone moving pages manually (accidentally or otherwise). 

 

 

 

 

Max Elfving _Ålander_ January 7, 2025

Hi @Ashok Rao ,

I'm glad you found my question and I'm sorry you have the same problem.

Way to go to think outside the box and reverse the question! Unfortunately I can't use this since I don't want all pages I label with that label to move to one parent. My label is too generic for that.

Like Ashok Rao likes this
0 votes
Connor
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.
September 22, 2023

Hi @Max Elfving _Ålander_ your question intrigued me so I tested this out myself, and this doesn't seem possible using the "When page moved" trigger. The problem with that trigger is the "space" and "parent" conditions are being evaluated against the original page location instead of the final page location. In "Jira Automation" I would use the Re-fetch issue data action, to get the new issue properties (page in this case), but there isn't an equivalent action for "Confluence Automation". 

As a workaround I was able to use the "Scheduled" trigger to add labels to the child pages of a specific parent page. My rule looks like:

  • Trigger: Scheduled
  • Branch rule / related entities:
    • CQL: space = 123 AND parent = 456 AND label != "ABC"
  • Action: Add label "ABC"

This successfully adds the "ABC" label to the child pages on whatever schedule it runs at. Note: Remember to add the label != "label" condition to the CQL statement, so the label is only added to pages where its missing. If you don't do this the label will be added (it just overwrites the existing label) every time the rule runs, which will unnecessarily increase your automation usage which could potentially see you start hitting the usage limits.

Max Elfving _Ålander_ September 28, 2023

Hi @Connor,

thanks for taking your time to look into this!

I think your approach makes sense so I tried it. Unfortunately I it didn't work for me.

When I ran the rule the status was "Some errors" and the action details said 
"
CQL COnDItion

No CQL-compatible content found in the rule context; there is nothing to check against the CQL query. The CQL condition component can only follow components that involve CQL-compatible content, such as the blogpost published trigger, the publish new page action, or the related entities branch.
"

I check the query which is valid and it has found 25 contents.
Any ideas to what the problem might be?

Suggest an answer

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

Atlassian Community Events