Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi Community,
I am trying to run a Confluence Automation script, to identify all pages in my space that have a specific label attached to them, and apply a page restriction.
This script would be a one-off run to restrict all pages that already have the label.
There is then a second script that restricts pages as the label is applied.
The first script (one-off) throws an error, even though the CQL seems to validate fine. See below.
CQL: type="page" and label="100"
CQL validation: valid query. 1 contents found
Error when running script: 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.
Any suggestions?
Can you take a screenshot about the complete rule including the trigger? Trim down the rule to simplest configuration that can be used to reproduce the problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My guess is that it doesn't know what to match the query against as there is nothing selected to compare.
You might need to add a query to select all pages published in the last 24 hours and then check the field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, Mike. It's strange though that when I validate the query, it does find the 1 match (which is correct, in this sample Space).
I will try to further modify the query...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Claudio Palmeri We have an automation that also runs a CQL search periodically, but we use a different component, not the "if" block.
Can you try the "Branch rule / related entities" block?
(Otherwise I totally agree with @Mike Monk's idea what is the actual root cause in your case.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have had a further play and came up with the same solution as Aron.
@Aron Gombas _Midori_ did that add the action to each page?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not sure that I understand the question...
But if you asked if the rule configured this way processes all pages and each page separately, then the answer is yes. It actually works for me (prints the page names one by one to the audit log).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Aron Gombas _Midori_ and @Mike Monk - confirming that I was able to run the automation rule using the Branch rule / related entities construct and restrict page successfully! Thank you for your help with this!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think that it is the root cause, but technically you don't the quotes around the content type. Your query should be like this:
type=page and label="100"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the response.
I have tried with and without the quotes. Using uppercase AND. Putting the whole thing in round brackets.
The validation always works (it's correct, in the test space there is only 1 page matching the criteria), but then when I run the script it fails...
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.