CQL Query for "Page Status"
Asked by Ken Young:

With Automation for confluence now live, I was wondering if there is a way (via CQL) to query for "Page Status" in confluence?


Answers:
author: Levente Szabo _Midori_
body: [@Ken Young](/t5/user/viewprofilepage/user-id/4596309)

May I ask what automation action you want to fire based on the [Confluence page status](https://www.midori-global.com/blog/2023/04/28/confluence-page-status?utm_source=cac&utm_medium=cac-comment-2246087&utm_campaign=gh)?

comments: author: Ken Young
body: Hi [@Levente Szabo _Midori_](/t5/user/viewprofilepage/user-id/570444) . My goal is to have an administered status for pages (ie. not to us tags) and to be able to automate documentation "freshness" checks. The CQL would provide the metadata for the lifecycle of the document. Some documents can be marked "Don't review" and be ignored (via the CQL), others in different statuses could then have notification workflows automatically kicked off, or associated Jira Tickets created to track the "updates" to the docs.

Thx


author: Levente Szabo _Midori_
body: In this case, I recommend looking into the dedicated Confluence lifecycle management solution, [Better Content Archiving for Confluence](https://marketplace.atlassian.com/apps/123/better-content-archiving-for-confluence?hosting=cloud&tab=overview&utm_source=cac&utm_medium=cac-comment-2246087&utm_campaign=gh). After becoming a go-to tool for Data Center and Server, it is now available for Cloud as well.

[Better Content Archiving](https://www.midori-global.com/products/better-content-archiving-for-confluence/cloud?utm_source=cac&utm_medium=cac-comment-2246087&utm_campaign=gh) allows you to create your own set of statuses with their CQL definitions and build your [content status schemes](https://www.midori-global.com/products/better-content-archiving-for-confluence/cloud/documentation/configure/content-status-schemes?utm_source=cac&utm_medium=cac-comment-2246087&utm_campaign=gh). The app automatically classifies content based on your rules and you can launch content review workflows using notification emails.

The app is prepared for processing a large number of pages in enterprise Confluence sites, and the UI is also geared toward managing many spaces and pages conveniently.

As a next step of the launch process, automatic archiving of Confluence pages will also be available.

![confluence-cloud-review-status-label.png](https://community.atlassian.com/t5/image/serverpage/image-id/236380i2B590CA064580AB3/image-size/large?v=v2&px=999 "confluence-cloud-review-status-label.png")

*(Please note that I'm part of the team developing Better Content Archiving for Confluence.)*


author: Ken Young
body: Thanks for the product info.

Honestly, would rather fix via automation because it is a simple use case that really doesn't need to have larger reoccurring monthly cost. Hopefully this information is exposed to CQL in the future.


author: Derek F.
body: Hey [@Ken Young](/t5/user/viewprofilepage/user-id/4596309) did you get this resolved?

It doesn't look like we have access to anything like "page.status" in the documentation at <https://developer.atlassian.com/server/confluence/advanced-searching-using-cql/>. However, there is access to labels ... but I don't see a way to copy the status to the labels.

fwiw, we use [Workflows for Confluence](https://marketplace.atlassian.com/apps/1222276/workflows-for-confluence?tab=overview&hosting=cloud) for approvals in a "draft" space that, once approved, get published to a "public" space

EDIT: I created an issue for this at [CONFCLOUD-75625](https://jira.atlassian.com/browse/CONFCLOUD-75625)

Vote for it!

comments: author: Ken Young
body: Thanks for the reply. We are already utilizing quite a few plugins, so trying to avoid adding another one. We will just us Jira until this becomes an available feature.


author: Ashley Hudson
body: Heya [@Ken Young](/t5/user/viewprofilepage/user-id/4596309) ,

I believe the CQL you are looking for is the following:

space = "xxx" AND status = XXX

I hope this helps and let me know if you have any other questions!

Kind Regards,

Ashley Hudson

comments: author: Ken Young
body: I couldn't seem to find this in the CQL docs. Thank you Ashley.


author: Ashley Hudson
body: Sweet! Glad I could help! :)


author: Ken Young
body: I spoke to soon--- I am getting the error:

Invalid CQL {#toc-hId--496459693}
---------------------------------

No field exists with the name: 'status


author: Kristj?n Geir Mathiesen
body: Man, sooooo close. I am looking for the exact same. Did you figure it out, [@Ken Young](/t5/user/viewprofilepage/user-id/4596309) ?


author: Ken Young
body: [@Kristj?n Geir Mathiesen](/t5/user/viewprofilepage/user-id/1909016) No solution. To be honest I haven' tried again. I haven't been looking at release notes to see if this was exposed yet.


author: Aron Gombas _Midori_
body: I didn't work for me, either. I got the same error message as [@Ken Young](/t5/user/viewprofilepage/user-id/4596309) ... Weird.


author: Patrick Wittman
body: [@Ken Young](/t5/user/viewprofilepage/user-id/4596309) If you haven't seen this yet, this has now been added to CQL but I also haven't seen it reference in the CQL documentation.

the element is actually \`**pageStatus**\`

So if you wanted to filter and only show pages with the **Verified** page status you can use **pageStatus = "Verified"** in your CQL query and it will only return pages that have that status.


author: Ken Young
body: Thank you [@Patrick Wittman](/t5/user/viewprofilepage/user-id/5437648) I will have to take a look to check it out. I did a quick basic query in a branch rule and it worked as expected..


author: Jonathan Smith
body: [@Ken Young](/t5/user/viewprofilepage/user-id/4596309)

In automation, I found I can only utilize page status data with the **{{smart values}} condition**.

* In my case, when published and **page status = Empty**, change the page status to Draft.

This fails when I try the CQL condition, but the smart values condition seems to work.

![hello.png](https://community.atlassian.com/t5/image/serverpage/image-id/329277iDF686C79F374F816/image-size/large?v=v2&px=999 "hello.png")

comments: author: Patrick Wittman
body: I haven't tried using this in automation yet, however, you can now target the page status in CQL using \`**pageStatus\`**. I haven't seen this element added to the CQL documentation yet but it does work.

For example if I want to filter to pages with the status of **Verified** then in my CQL query I can use **pageStatus = "Verified"** and the query will only return pages with that page status.


author: Anastasia Bek _Stiltsoft_
body: G-Day [@Ken Young](/t5/user/viewprofilepage/user-id/4596309)

We can relate to the need to have an administered status for pages and to be able to automate documentation relevance checks. This is why our team has delivered [Handy Page Status](https://docs.stiltsoft.com/hmfc/cloud/handy-page-status) and [Handy Page Status Report](https://docs.stiltsoft.com/hmfc/cloud/handy-page-status/page-status-report) functionalities based on the following data to ace in our reporting journeys with help of our [Handy Macros for Confluence](https://marketplace.atlassian.com/apps/1214971/handy-macros-for-confluence-formatting-and-interactive-ui?tab=overview&hosting=cloud&utm_source=atlassian-community&utm_medium=stiltsoft-article&utm_campaign=handy-macros-traffic-sources&utm_id=1216111&utm_content=HPSR_CQL)

The report can be administered by the following data:

* Confluence spaces where the status is set
* Handy Page Status sets
* Handy Page Status options
* Confluence users who set the status
* Handy Page Status dates

And can look like this:

![HPSR.png](https://community.atlassian.com/t5/image/serverpage/image-id/289732iC63166D241030A22/image-size/large?v=v2&px=999 "HPSR.png")

Feel free to check out and play with these macros of [Handy Macros for Confluence](https://marketplace.atlassian.com/apps/1214971/handy-macros-for-confluence-formatting-and-interactive-ui?tab=overview&hosting=cloud&utm_source=atlassian-community&utm_medium=stiltsoft-article&utm_campaign=handy-macros-traffic-sources&utm_id=1216111&utm_content=HPSR_CQL) to elevate page status administration

Best wishes.

Anastasia


Tags: automation

cloud

confluence-cloud