Confluence Automation | CQL Error

Claudio Palmeri September 12, 2023

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?

2 answers

1 accepted

0 votes
Answer accepted
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 12, 2023

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.

Claudio Palmeri September 12, 2023

Here it is, including error message.

automation_error.png

Mike Monk September 12, 2023

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

Claudio Palmeri September 12, 2023

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...

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 13, 2023

@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.)

Confluence.png

Like # people like this
Mike Monk September 13, 2023

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?

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 13, 2023

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).

Like Mike Monk likes this
Mike Monk September 13, 2023

Sorry it was badly worded, but yes did the action happen for every page in the initial query :)

Claudio Palmeri September 14, 2023

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!

Like # people like this
0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 12, 2023

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"
Claudio Palmeri September 12, 2023

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...

Suggest an answer

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

Atlassian Community Events