# How can I pull results from a CQL query into a custom email automation?

**URL:** <https://community.developer.atlassian.com/t/how-can-i-pull-results-from-a-cql-query-into-a-custom-email-automation/103045>\
**Category:** Confluence Cloud\
**Tags:** cql\
**Created:** [October 1, 2026, 9:06pm UTC](https://community.developer.atlassian.com/t/how-can-i-pull-results-from-a-cql-query-into-a-custom-email-automation/103045 "2026-10-01T21:06:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SadajaRiddickJohnson](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/sadajariddickjohnson/32/56169_2.png) [@SadajaRiddickJohnson](https://community.developer.atlassian.com/u/SadajaRiddickJohnson)\
**Post date:** [October 1, 2026, 9:06pm UTC](https://community.developer.atlassian.com/t/how-can-i-pull-results-from-a-cql-query-into-a-custom-email-automation/103045/1 "2026-10-01T21:06:31Z")

</div>

I am attempting to setup an automation that involves using a CQL query to find all pages in one of my organizations’ spaces that have not been updated in over a year, and then send an email with all of these found pages.

I want this email to be sent to me once a month, so I have the initial trigger as Scheduled. I then created an IF or ELSE condition with the CQL query `type = page AND lastModified < 2025-01-01`.

I am stumped on the next step as I realized adding the ‘Send Custom Email’ action would not send the results of the query to me. Am I misinterpreting the capabilities here? Or is there an easier solution here?

---

<div class="post-metadata">

**Author:** ![Support.Kitefold](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Support.Kitefold](https://community.developer.atlassian.com/u/Support.Kitefold)\
**Post date:** [November 16, 2026, 11:06pm UTC](https://community.developer.atlassian.com/t/how-can-i-pull-results-from-a-cql-query-into-a-custom-email-automation/103045/2 "2026-11-16T23:06:16Z")

</div>

Going by Atlassian’s automation docs, the CQL condition only checks whether the rule’s trigger matches the query, and the docs also say that, unlike Jira, Confluence’s Scheduled trigger doesn’t take a query, so there’s no list of pages for the email to use. The piece that looks right for this is the Lookup pages action. First keep your monthly Scheduled trigger, then add Lookup pages with “Last updated more than” set to a year, which also saves changing a fixed date every time. Then add a smart values condition so nothing goes out when it finds nothing:

{{lookupPages.size}} greater than 0

and in the email action list them like this, which another Community thread (Automated email for inactive old pages) reported working:

{{#lookupPages}}

- {{title}} - {{url}}  
{{/}}

Two things worth checking, as I haven’t run this exact rule myself. Lookup pages filters on author, created and last updated dates rather than free CQL, so build the rule in that space’s own automation settings and check the email only lists that space’s pages. And Atlassian’s announcement of the action said it returns up to 150 pages, so a big space may not all fit in one email. If emailing each page’s owner suits you better, there’s also a ready-made template, “Notify people about inactive pages when scheduled (recurring)”.
