I have an automation that notifies people about pages that haven't been updated in 6 months and don't have the "deprecated" label.
The automation works, however, it sends one message per page returned (several messages) instead of sending one single message with the list of pages returned.
If I add the action "Then: Send Slack message" inside the Branch, the automation works but I receive several messages in the Slack channel.
If I add the action "Then: Send Slack message" outside the Branch , I receive an empty message (my idea of using the variable doesn't work outside the branch).
How can I solve this issue?
Here's the complete automation:
1. Trigger: Scheduled
2. Action: Lookup Pages (Last updated more than 6 months ago)
3. Action: Create Variable Variable Name: pageList ( empty)
4. Branch: For Each (Smart Value) Smart Value: {{lookupPages}} Variable Name: page
5. If Condition First Value: {{page.labels.join(",")}} Condition: Does not contain Second Value: deprecated
6. Action: Create Variable (to edit the previous variable) Variable Name: pageList Value: {{#if(pageList)}}{{pageList.concat("\n")}}{{/}}{{page.title}} at {{page.url}} Last updated on: {{page.dateLastUpdated.shortDate}}, Author: {{page.author.fullName}}
7. Action: Send Slack Message The following pages have not been updated in the last 6 months and do not have the "deprecated" label: {{pageList.concat("\n")}}
Hi @Eloá -- Welcome to the Atlassian Community!
To send one single message rather than one message per page, try removing the branch:
If you instead wanted to send one message to each author with their list of pages, you could use a variation of that which branches over the distinct authors. Please see this article which uses a similar technique to send one email per assignee: https://confluence.atlassian.com/jirakb/automation-to-send-email-only-once-per-assignee-1310985609.html
Kind regards,
Bill
Hi, @Bill Sheboy
Thank you for your quick response!
How can I use the "Lookup pages" action with CQL? In Confluence automation, the "Lookup pages" action only provides three predefined criteria to choose from (Last updated, Author, and Created), and it doesn't seem to offer the option to include custom CQL queries.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, I do not currently have Confluence automation in my instance, and so I remembered it incorrectly. Please try using Lookup CQL Results instead:
https://support.atlassian.com/cloud-automation/docs/actions-in-confluence-automation/#Lookup-actions
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.
Awesome; I am glad to learn it is working! Please consider marking this question as "answered" to help others with a similar need find solutions faster. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Isis and Bill,
I'm working on a request to configure a rule similar to this, but I don't see an option in Confluence Automation to lookup pages using CQL. The only options that I have under the Lookup Pages component are Author, Created, and Last updated.
Would you be able to share a screenshot or more details about the configuration you're using to lookup pages using CQL?
Thanks in advance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jeremiah Rappley -- Welcome to the Atlassian Community!
My mistake as I am currently not using Confluence automation rules: one may trigger or branch on CQL to Confluence pages but not use Lookup Pages with CQL.
As a workaround you could call the REST API content search with CQL and the Send Web Request action.
Here is the content search endpoint: https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-search/#api-wiki-rest-api-search-get
And here is a how-to article for calling a REST API with Send Web Request: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828
Kind regards,
Bill
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.