Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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. 

2 answers

1 accepted

0 votes
Answer accepted
Davin Studer Community Leader 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>

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.

Davin Studer Community Leader 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.

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

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

 

This community is great!

Like Davin Studer likes this

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

Suggest an answer

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

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

187 views 0 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you