In the Confluence Cloud Automation Rule Details, there is a checkbox "Check to allow other rule actions to trigger this rule. Only enable this if you need this rule to execute in response to another rule." at the very bottom (see screenshot below). Is there a way to trigger a specific Confluence Cloud Automation Rule from another rule?
Background why I want to do this: There are no CQL sub-queries in Confluence and e.g. ancestor and parent only accept specific page ids (no "~" to take pages with a title containing some string). I want to build an automation which checks for pages with a parent with some title and then again for pages having one of the search results as an ancestor. In Confluence Cloud Automation, I can use the "Branch rule / related entities" branch to execute CQL, but in this branch, I can't execute a "sub-branch" using the previous CQL search results in another CQL.
Please take a look at my example screenshot below: First, I want to get all pages which have "Ongoing" in its title. Then I want to get the pages with "Project Landingpage" in its title which have one of this "Ongoing" pages as a parent. Afterwards, I want to check for all the pages below each "Project Landingpage" page when they have been last modified to decide if an automation should execute some action, e.g. send an email to somebody (e.g. the page owner of the respective "Project Landingpage ..."). Now let's say we have around 100 categories and below each, there is a page tree like below Category A, with 0 to 20 "Project Landingpage ..." pages below the "Ongoing - Category ..." page. The check for last modified should be executed for all of the pages below these "Project Landingpage ..." pages, but not for the pages below "Project Landingpage ..." pages which might be already below "Closed - Category ..." pages (as the work on them is already completed but they should still be kept for documentation and reference).
Thanks to @Bill Sheboy 's hint with the Send Web Request action, I was able to find a solution myself. I will post it here hoping it might be useful for others as well.
Here is my solution:
The rule should look like this:
The CQL for "Branch rule / related entities" is: title ~ "Ongoing" and type = page
The configuration details for Send web request are shown below:
To get the correct Web request URL and the custom data, you have to setup the start of the second rule already (I will describe this below). So first, let's finish the Headers configuration here:
Authorization: Following the great tutorial by Brad Evans here - don't forget to write "Basic " before the result of your PowerShell Base64 encoding, especially if you click the "Hidden" checkbox and come back later to update it ;)
Content-Type: application/json
Create a second rule with "When: Manually triggered" which can then use CQL in another "Branch rule / related entities". Don't worry too much about the Branch details for now as we first want to get the configuration of the first rule done and for this we mainly need the "When: Manually triggered", any action and the configuration, that the rule can be triggered by other rule actions as shown in the second screenshot below.
Very important: Allow this second rule in the Rule details to be triggered by another rule (see screenshot below).
Then (after clicking Update to save the rule configuration and enable it), go to a page in the space you configured your automations for and use the "..." menu as shown in the screenshot below to trigger the automation manually using the "Automate" action:
Open the developer tools (for your Browser, Chrome in my screenshot on the right side) and go to the Network tab. Then select the rule you configured in the Page automations pop-up on the left side and click on Automate to start it. Hint: it is a good idea to clear the developer tools data before to spot your rule easier.
Search for the rule ID in the developer tools in the Network tab as shown below (you find the rule ID when you hover over your rule in the Automation - Rules overview), click on it and copy the Request URL in the Headers tab as shown below:
This is the "Web request URL" rule 1 should send the web request to, so open the rule 1 config and paste it there so that it looks like in the screenshots above for rule 1.
Then go to the Payload tab in the developer tools, right click on the Request Payload and click on "Copy value" as shown in the screenshot below.
This is the "Custom data" rule 1 should send the web request with, so open the rule 1 config and paste it there so that it looks like in the screenshots above for rule 1. Then edit the page ID at the end of the "Custom data" to be "{{cqlResult.id}}" so that it sends the page ID of the respective CQL result instead of the static page ID you just triggered it manually for (see the screenshots for rule 1 above).
If you saved and did everything correctly so far, you should be able to run rule 1 successfully triggering rule 2 in case your CQL returns any results.
As the answer already is pretty long, I will now focus on the core aspects of the rest of the solution.
In rule 2, we use the same concept as in rule 1 to trigger a rule 3 and 4 which looks like rule 2 (manually triggered). Example CQL: parent = {{page.id}} and title ~ "Project Landingpage" and lastmodified < startOfDay("-56d")
The key idea here for rule 3 and 4 is that we use "Branch rule / related entities" to run a CQL and if the result is empty (meaning no pages are found which were modified in the given time range), we do some action. To check this, we use the "{{smart values}} condition" as shown in the screenshot below comparing "{{cqlResults}}" to empty (just leaving the second value empty and using "equals" to compare).
This way, I achieved to implement my original approach described in my question above. Please let me know in case of any further questions or if you need more details. And thanks again for the idea to use Send Web Request @Bill Sheboy!
Best regards
Christoph
Short answer: I do not believe your scenario can be solved with automation rules, although it might be possible using the REST API endpoints and called from a custom application with better looping options. You may want to investigate if there are marketplace apps to help manage / query pages this way.
For more information...
You are correct that branches cannot be nested yet. There are some open suggestions to add this capability. Some workarounds for such situations are:
Even if the nested branching was possible, I do not believe "Last Modified" (or createdAt for a version) is available unless an individual page is read with the endpoints. This will lead to the rule needing to read each individual page for your scenario.
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.
Hi @Bill Sheboy
Thanks a lot for your fast and detailed reply!
The Send Web Request action suggestion was a great one, I am happy to report that I just were able to use it to implement my original idea. I will post my solution as an answer to my question right after I replied to you.
As you are speaking of "open suggestions to add this capability" above: is there any quick and reliable way to find all open suggestions related to Confluence Automation, so that I could vote on them?
Thanks a lot again and in advance for your support and keep being amazingly helpful, you rock!
Best regards,
Christoph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well done solving this, particularly the part of using the Send Web Request action to trigger the manual rule! I recommend monitoring that one to ensure it does not trip the 10 loop limit due to repeated calls from the Scheduled Trigger rule.
Regarding open suggestions and defects, you may search the public backlog for those...such as checking the Automation and Confluence Cloud projects:
Please add additional criteria if you want to narrow the search by Summary, Description, etc.
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.