Can "Current Page" be used in a Task Report
Asked by Jim_Leask:

Is there a way to assign the "current page" in a task report, allowing it to report on all tasks assigned on that page?

We have meeting pages in Confluence, and frequently take the minutes and assign tasks on the page. We want to have a Task Summary report at the bottom of the same page that shows all tasks assigned in that meeting.

I can't create a Task Summary report with "Current Page" as the page. I can use the specific name of the page, however, if we copy the page to use as a template for the next meeting, the Task Report is wrong and need to be manually corrected.

Also, I would like this Task Report to report on all tasks together, as those are what is relevant for this page of work. The Task Status can only be "Incomplete" or "complete" but not both.


Answers:
author: Davin Studer
body: This could be done with a user macro that wraps the built-in task report macro and dynamically supplies the page property. See the below user macro.

**Macro Name:**   
task_report_current_page

**Macro Title:**   
Task Report Current Page

**Macro Body Processing:**   
No macro body

**Template:**

```
## Developed by: Davin Studer## Date created: 05/12/2020## @param Label:title=Label(s)|type=string|required=false|desc=Only show tasks on pages with this label## @param Assignees:title=Assigned to|type=username|required=false|multiple=true|desc=Only show tasks assigned to these people## @param Creators:title=Created by|type=username|required=false|multiple=true|desc=Only show tasks created by these people## @param Created:title=Created after|type=string|required=false|desc=Only show tasks created on or after this date. Dates must be entered as dd-mm-yyyy.## @param Status:title=Task status|type=enum|enumValues=complete,incomplete|default=incomplete|desc=## @param PageSize:title=Number of tasks per page|type=enum|enumValues=10,20,40|default=20|desc=## @param Columns:title=Columns to display|type=string|required=false|default=description,duedate,assignee,location|desc=Allowed columns are description, duedate, assignee, location, completedate, labels## @param Sort:title=Sort by|type=enum|enumValues=due date,assignee,page title|default=due date|desc=## @param Reverse:title=Reverse sort|type=boolean|default=false|desc=#if($paramAssignees && $paramAssignees != "")    #set($assignees = $paramAssignees.split(","))#end#if($paramCreators && $paramCreators != "")    #set($creators = $paramCreators.split(","))#end<ac:structured-macro ac:name="tasks-report-macro" ac:schema-version="1">    <ac:parameter ac:name="pages">$content.id</ac:parameter>    #if($paramLabel && $paramLabel != "")    <ac:parameter ac:name="labels">$paramLabel</ac:parameter>    #end    #if($paramAssignees && $paramAssignees != "")    <ac:parameter ac:name="assignees">    #foreach($assignee in $assignees)        <ri:user ri:userkey="$userAccessor.getUserByName($assignee).key"/>    #end    </ac:parameter>    #end    #if($paramCreators && $paramCreators != "")    <ac:parameter ac:name="creators">    #foreach($creator in $creators)        <ri:user ri:userkey="$userAccessor.getUserByName($creator).key"/>    #end    </ac:parameter>    #end    #if($paramCreated && $paramCreated != "")    <ac:parameter ac:name="createddateFrom">$paramCreated</ac:parameter>    #end    <ac:parameter ac:name="status">$paramStatus</ac:parameter>    <ac:parameter ac:name="pageSize">$paramPageSize</ac:parameter>    #if($paramColumns && $paramColumns != "")    <ac:parameter ac:name="columns">$paramColumns</ac:parameter>    #end    <ac:parameter ac:name="sortBy">$paramSort</ac:parameter>    <ac:parameter ac:name="reverseSort">$paramReverse</ac:parameter></ac:structured-macro>
```

comments: author: Jim_Leask
body: Thanks for this script. I haven't tried it (I'm not sure how to apply a script as haven't needed them before), but I'm sure it would work.

But wow - that is a lot of work for something that IMO should be built in. Sadly, it looks like the [feature request for this was closed](https://jira.atlassian.com/browse/CONFSERVER-53073?_ga=2.208314770.1207155135.1589465409-99132078.1588940233&error=login_required&error_description=Login+required&state=4260184e-1fdf-4410-95aa-d114f0202e86). I'll accept your answer as it looks like the best we can do for now.


author: Davin Studer
body: User Macros are created in Confluence Admin -\> User Macros. Once you create the user macro you can add it to a page just like you would a regular macro.


author: Alexander Wirtz
body: [@Davin Studer](/t5/user/viewprofilepage/user-id/781467) Thanks for this script. This will save me a lot of time! I tried it out and it worked perfectly.

Is there a solution to make another macro that will always set the parent page? This will solve all my problems. :)


author: Davin Studer
body: This would work for showing tasks on parent pages.

```
## Developed by: Davin Studer## Date created: 05/12/2020## @param Label:title=Label(s)|type=string|required=false|desc=Only show tasks on pages with this label## @param Assignees:title=Assigned to|type=username|required=false|multiple=true|desc=Only show tasks assigned to these people## @param Creators:title=Created by|type=username|required=false|multiple=true|desc=Only show tasks created by these people## @param Created:title=Created after|type=string|required=false|desc=Only show tasks created on or after this date. Dates must be entered as dd-mm-yyyy.## @param Status:title=Task status|type=enum|enumValues=complete,incomplete|default=incomplete|desc=## @param PageSize:title=Number of tasks per page|type=enum|enumValues=10,20,40|default=20|desc=## @param Columns:title=Columns to display|type=string|required=false|default=description,duedate,assignee,location|desc=Allowed columns are description, duedate, assignee, location, completedate, labels## @param Sort:title=Sort by|type=enum|enumValues=due date,assignee,page title|default=due date|desc=## @param Reverse:title=Reverse sort|type=boolean|default=false|desc=#set($parentId = $pageManager.getPage($content.id).parent.getContentId().asLong())#if ($parentId)    #if($paramAssignees && $paramAssignees != "")        #set($assignees = $paramAssignees.split(","))    #end        #if($paramCreators && $paramCreators != "")        #set($creators = $paramCreators.split(","))    #end        <ac:structured-macro ac:name="tasks-report-macro" ac:schema-version="1">        <ac:parameter ac:name="pages">$parentId</ac:parameter>        #if($paramLabel && $paramLabel != "")        <ac:parameter ac:name="labels">$paramLabel</ac:parameter>        #end        #if($paramAssignees && $paramAssignees != "")        <ac:parameter ac:name="assignees">        #foreach($assignee in $assignees)            <ri:user ri:userkey="$userAccessor.getUserByName($assignee).key"/>        #end        </ac:parameter>        #end        #if($paramCreators && $paramCreators != "")        <ac:parameter ac:name="creators">        #foreach($creator in $creators)            <ri:user ri:userkey="$userAccessor.getUserByName($creator).key"/>        #end        </ac:parameter>        #end        #if($paramCreated && $paramCreated != "")        <ac:parameter ac:name="createddateFrom">$paramCreated</ac:parameter>        #end        <ac:parameter ac:name="status">$paramStatus</ac:parameter>        <ac:parameter ac:name="pageSize">$paramPageSize</ac:parameter>        #if($paramColumns && $paramColumns != "")        <ac:parameter ac:name="columns">$paramColumns</ac:parameter>        #end        <ac:parameter ac:name="sortBy">$paramSort</ac:parameter>        <ac:parameter ac:name="reverseSort">$paramReverse</ac:parameter>    </ac:structured-macro>#elseCannot show tasks on parent page because this page has no parent.#end
```


author: Alexander Wirtz
body: Wow, thank you for the quick reply! Just tried it out and it worked perfectly!

This community is great!


author: Strahlemann
body: Thank you!  
This helped a lot!


author: Aleksander Altberg
body: Hey, I'm following [t](https://confluence.atlassian.com/doc/writing-user-macros-4485.html )[hese steps](https://confluence.atlassian.com/doc/writing-user-macros-4485.html ) to try and add a custom user macro, however none of the options mentioned in that guide actually exist.  

How do I create and apply a custom user macro?


author: Dominic Lagger
body: Hi [@Aleksander Altberg](/t5/user/viewprofilepage/user-id/4886961)

If this option doesn't exist, you are on confluence cloud, where user macros do not exist.

Regards, Dominic


author: iuk_uk-halle_de
body: Do anyone here know a solution for show the percentage of completed tasks on a parent page? Would be great!


author: becki.marsh
body: I have a similar need, we have a few parent pages that need to pull actions from on their specific child pages. Is this also possible? [@Davin Studer](/t5/user/viewprofilepage/user-id/781467)

Currently I save the new parent page \& then go back in and edit the task report to use that page as the location.

Thanks for any help you can provide. :)

EDIT : I found your answer in another [thread](https://community.atlassian.com/t5/Confluence-questions/How-can-I-make-the-taskreport-reference-to-lt-current-page-gt/qaq-p/61100).

comments: author: Ronald Wenninger
body: [@Davin Studer](/t5/user/viewprofilepage/user-id/1018164) would you also be able to post the version of the marco that reports all tasks in the page subtree (child pages, child pages of these, ...) originating from the page where the macro is used?


author: Thierry Dalon
body: This is done by default if you enter a page it takes also all the children


Tags: confluence-server

server