Hi all,
I'm trying to create an automation that will edit the status macro on a page when all the tasks on said page have been completed.
Is this possible?
Thank you!
Hello @Harry Lee ,
Technically this is possible: it is up to you how to do it:
I suppose the general approach would be to run the code when the new version is created (when checkbox is ticked, it creates a new page version) and parse page body to check if all the get all tasks from xHTML/HTML and if all tasks have 'complete' status that is set as the xhtml attribute:
<ac:task-status>complete</ac:task-status>
<ac:task> <ac:task-id>2</ac:task-id> <ac:task-status>complete</ac:task-status> <ac:task-body><span class="placeholder-inline-tasks"><ac:link><ri:user ri:account-id="xxx" /></ac:link> task here <time datetime="2023-09-28" /> </span></ac:task-body> </ac:task>
If all the ``` ac:task ``` elements have complete status then you can update the page and update the Status macro inner code (<ac:parameter ac:name="title">resolved</ac:parameter>).
<ac:structured-macro ac:name="status" ac:schema-version="1" ac:macro-id="c0849f79-ce68-46ba-8539-088974fc596a"><ac:parameter ac:name="title">resolved</ac:parameter></ac:structured-macro>
Is this possible using the built in Confluence Automation, or is it only possible with Scriptrunner or Forge?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Andrii Maliuta - That makes sense in theory. How would one check if all ac;task status have been checked?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please re-read the whole comment.
If all the ``` ac:task ``` elements have complete status then you can update the page and update the Status macro inner code (<ac:parameter ac:name="title">resolved</ac:parameter>).
If the child parameter of the element contains 'resolved'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Andrii Maliuta apologies, I meant would you use an automation within confluence automation such as the send web request? I'm new to utilising the REST api so trying to learn as much as I can!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Harry Lee !
I suppose that the options are:
If I am not mistaken, usually Script Runner app (https://marketplace.atlassian.com/apps/1215215/scriptrunner-for-confluence?hosting=cloud&tab=overview ) is used for the easy of automation as it has built-in listeners, behaviors, jobs, etc.
Also, the custom addon can be created using Forge/ Atlassian Connect if you need some custom functionality.
Hope I did not confuse :)
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.