Can "Current Page" be used in a Task Report

Jim_Leask
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 11, 2020

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. 

3 answers

1 accepted

2 votes
Answer accepted
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2020

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>
Jim_Leask
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 14, 2020

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. I'll accept your answer as it looks like the best we can do for now.

Like # people like this
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2020

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.

Alexander Wirtz
Contributor
January 11, 2021

@Davin Studer 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. :) 

Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 11, 2021

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>
#else
Cannot show tasks on parent page because this page has no parent.
#end
Alexander Wirtz
Contributor
January 12, 2021

Wow, thank you for the quick reply! Just tried it out and it worked perfectly! 

 

This community is great!

Like Davin Studer likes this
Strahlemann January 12, 2022

Thank you!
This helped a lot!

Aleksander Altberg
Contributor
May 18, 2022

Hey, I'm following these steps 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?

Dominic Lagger
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2022

Hi @Aleksander Altberg 

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

Regards, Dominic

Ashok Rao December 2, 2024

Hi,

Does anyone have an idea whether there is any other solution then in Confluence Cloud? 

I am making a template, and would like to create in that template a task report of 'current page'. From what I can understand, this is not possible at this moment in the cloud?

Thanks,

0 votes
iuk_uk-halle_de June 21, 2022

Do anyone here know a solution for show the percentage of completed tasks on a parent page? Would be great!

0 votes
becki.marsh January 12, 2021

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 

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

Ronald Wenninger
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 12, 2022

@Davin Studer 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?

Thierry Dalon
Contributor
November 10, 2022

This is done by default if you enter a page it takes also all the children

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events