How can I make the taskreport reference to <current page>
Asked by Josch Bencke:

*This question is in reference to Atlassian Documentation: [Task Report Macro](https://confluence.atlassian.com/pages/viewpage.action?pageId=590260009)*

How can I restrict the task report to summazire only those tasks, listed on the same page as the macro is - ++when I do not know the pagename yet++ - e.g. for templates or code snippets.

With other macros, there is a placeholder "@self" or "@localspace" available.


Answers:
author: Davin Studer
body: Here is what I would do. You will need the [Confluence Source Editor](https://marketplace.atlassian.com/plugins/com.atlassian.confluence.plugins.editor.confluence-source-editor/server/overview). It is free and made by Atlassian. First add a task report macro to your page and set it up the way you want without the page ... we'll get to that in a sec.

image2016-8-4 11:7:45.png

Then open up the source of the page(top right corner of the editor) to grab the storage format for the macro.

image2016-8-4 11:8:44.png

image2016-8-4 11:9:27.png

Select the macro storage format and copy it. The highlighted part in the above image is the page parameter and we are going to create a user macro that will implement the built-in task report macro but will dynamically swap out the page parameter.

Go to Confluence Admin -\> User Macros and create a new one. The below user macro definition is based on what you see above. If you want more of the report macro parameters set a certain way then do that before you copy the storage format for creating your user macro ... again we are just going to switch out that one "pages" parameter.

Page Task Report Macro

**Macro Name**page_task_report

**Macro Title**Page Task Report

**Description**Whatever you want

**Macro Body Processing**No macro body

**Template**

```
## Developed by: Davin Studer## Date created: 08/04/2016## @noparams?<ac:structured-macro ac:name="tasks-report-macro">    <ac:parameter ac:name="pages">$content.id</ac:parameter>    <ac:parameter ac:name="labels">Stuff</ac:parameter></ac:structured-macro>
```

You now have a macro that you can drop into your templates.  
[](https://community.atlassian.com/t5/Confluence-questions/How-can-I-make-the-taskreport-reference-to-lt-current-page-gt/qaq-p/61100?attachment-id=8579){#link_11868c55dfc873}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/10331/1/image2016-8-4%2011%3A8%3A44.png){#display_11868c55dfc873_0}  
[](https://community.atlassian.com/t5/Confluence-questions/How-can-I-make-the-taskreport-reference-to-lt-current-page-gt/qaq-p/61100?attachment-id=8580){#link_11868c55dfc873_0}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/10331/2/image2016-8-4%2011%3A9%3A27.png){#display_11868c55dfc873_2}  
[](https://community.atlassian.com/t5/Confluence-questions/How-can-I-make-the-taskreport-reference-to-lt-current-page-gt/qaq-p/61100?attachment-id=8581){#link_11868c55dfc873_1}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/10331/3/image2016-8-4%2011%3A7%3A45.png){#display_11868c55dfc873_4}

comments: author: Josch Bencke
body: Sounds cool - and thanks for your effort to make it a tutorial :smile:


author: John Quillen
body: Agree with Martin. This does not seem like a solution to the obvious need.


author: Davin Studer
body: Currently, you cannot point the task report macro at the current page. This allows you to create a wrapper around the built-in task report macro that will dynamically put in the page id for you ... effectively giving you the ability to point it at the current page. It may not be the ideal but it allows you get that functionality now instead of having to wait for it to be natively implemented.


author: John Quillen
body: Thanks for your quick response, Davin. Sorry about the way I expressed myself. My comment was aimed at Atlassian. To have to save the page I created and then search for that page is tedious when it should be straightforward. I created a template that includes a Task List for that page and would love to see that be able to reference \<self\> or something like that.

I don't have macro privs, so I can't implement your solution.


author: Jacek Choroszewicz
body: Hey Davin - thanks for the instructions, it helped me a lot :)

(removed description of the problem - as I managed to solve it)

It just works, my mistake. Thanks again!


author: Flora Vidal
body: Hi Davin,

Many thanks for your help. The Confluence Source Editor sure is a great tool for this purpose.

Cheers !


author: Rebecca Puypalat
body: Hi Davin,

I'm trying to implement your solution but whitout success.

Firstly, I cannot see user macro in macro menu. That's strange!

Secondly, if I try to copy/paste source code block directly on page to switch out that one "pages" parameter I got error about content.id.

If i replace through source editor content.id by page Id value (get from page information URL) it works.

I certainly missed something.

Attached my macro definition, source editor block which works and error message if I put $content.id in source editor.

All help is welcome.

![UserMacro.GIF](https://community.atlassian.com/t5/image/serverpage/image-id/48156i2B3EC2004DEE5A74/image-size/large?v=v2&px=999 "UserMacro.GIF")![sourceeditor.GIF](https://community.atlassian.com/t5/image/serverpage/image-id/48157i85D90D8B93F437AE/image-size/large?v=v2&px=999 "sourceeditor.GIF")![errorContentId.GIF](https://community.atlassian.com/t5/image/serverpage/image-id/48158iC0B9D6B2D2D786A9/image-size/large?v=v2&px=999 "errorContentId.GIF")


author: Davin Studer
body: In your user macro definition change the Macro Name to something other than tasks-report-macro. That is the built-in macro and we are creating a macro that wraps around it so it needs a different name than the built-in one.


author: Rebecca Puypalat
body: Hi Davin, thanks for your time.

Unfortunately changing name of macro does not solved issue. I have replace macro name by **customizedtaskreporting.**

I 'm still not able to see macro using UI menu or Keyboad shortcut '\[ '

Rebecca


author: Davin Studer
body: So the macro browser keyboard shortcut is '{' not '\['. Was that just a typo or are you using the wrong shortcut?

After you save the user macro you may need to refresh your page as the macro names are cached. Once you've refreshed the page and clicked edit if you type '{' and then start typing **customizedtaskreporting** it should show.


author: Rebecca Puypalat
body: Hi Davin,

It's a nightmare. I already created macro in the past. I don't understand why I still cannot see macro in menu or using shortcut after having refreshed page.

Rebecca


author: Joyce Patterson
body: Is there an easier way to do this?


author: Martin Boehme
body: related: <https://community.atlassian.com/t5/Confluence-questions/Can-you-add-a-Task-Report-to-a-template-that-shows-all-open/qaq-p/80698>

Unfortunately, I don't know a solution for this :(

Why is this question marked "solved"?


Tags: report

task