Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,359,846
Community Members
 
Community Events
168
Community Groups

Can "Current Page" be used in a Task Report

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

1 vote
Answer accepted

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>

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.

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.

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

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

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

 

This community is great!

Like Davin Studer likes this

Thank you!
This helped a lot!

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 Community Leader 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

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

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

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Watch 4 Confluence apps compete for Best App Demo in September's Appy Hours

Calling all collaborators! Appy Hours on the Atlassian Community is a monthly event where 4 Partner and app vendor presenters go head-to-head with 5-minute demos for the title of Best App Demo. I...

491 views 0 12
Read article

Atlassian Community Events