Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


How to add labels automatically to pages with a certain keyword in title?

Hi Confluence automation experts,

we need your help: we are not getting anywhere with the creation of an automatic rule and hope to get a hint here about our error:

The goal is to insert a specific label (test1) in a space (space key: jp) on pages with "test1" in the title that do not already have this label. Therefore we choose the sequence via automation rules:

> When: Scheduled

>> Every week on Mon at 11:00 AM

> If: CQL condition

>> space = jp AND title ~ "test1" AND label != "test1"

> Then: Add label

>> test1


After saving everything and publishing the rule we run a test and receive the following error:

CQL condition
Error in execution:
Expecting to have a content ID in context.. Trace ID: ec5f5a56-5a02-4331-. . .


What does this mean?

Everything we have tested and tried so far failed:
- the validation of the CQL query inside the rule creation shows green. Despite this, after executing the rule, it shows us this error.
- When we enter the CQL query using the direct CQL search, the pages are all displayed correctly.
 - Using the ID from the home page URL did not lead to success

Any idea how we can reach our goal to add labels to several pages automatically?

Thank you in advance for your ideas ;-)

2 answers

2 accepted

3 votes
Answer accepted
Jocelyn Kim
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 29, 2022

@Oliver Siebenmarck _Polymetis Apps_ 's suggestion would definitely work! Another option is to use the "Branch rule / related entities" component in conjunction with the scheduled trigger. This will create a CQL search and execute the action applied within the branch rule on every result (for up to 100 results). This should help you apply the labels to pages that are already created.

We have a "for each page" branch component also coming soon that may help simplify some of these use cases.

Oh wow, I'm very excited about the new component. Thanks for the spoiler alert ;-)

Oliver Siebenmarck _Polymetis Apps_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 30, 2022

Oh, that sounds pretty cool! Thanks @Jocelyn Kim , I'll definitely check that out, too!

Like Jocelyn Kim likes this

It works! Thank you so much!

Like Jocelyn Kim likes this
3 votes
Answer accepted
Oliver Siebenmarck _Polymetis Apps_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 29, 2022

Hi @Schuuudi ,

I'm by no means an expert in Automation for Confluence, but I just cannot pass on a label-related question.

That being said, I believe I know what happens. The Scheduled Trigger in Automation for Confluence runs without any specific page or space in context, basically meaning that it does not know which page to check and add a label to. The CQL you enter is just a condition, ie a check if a space/page that would be in context applies to your rule. It is not a list of all pages that your rule will be applied to.

Now, while that is mildly frustrating, there is a workaround to achieve the same result. And it doesn't even require an app.

Instead of running a rule every so often, you could simply add two rules triggered by "Page published" and "Page edited" respectively. On those rules, you can use your CQL query to check if the page title contains your keyword and then label the page accordingly. This approach has the additional advantage of adding the label almost immediately.

Hope that helps,

Thanks @Oliver Siebenmarck _Polymetis Apps_ for your idea - and so fast ;-) . We will try it out.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events