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

Can you add a Task Report to a template that shows all open tasks that appear on that page that is being created by the template?

Rob Katz December 15, 2014

I can insert the Task Report macro, and what I'm hoping to do is include a filter for the page being created by the template.

6 answers

1 vote
Alexander Horn April 30, 2015

Here you are:

 

## Macro title: Task Report for Templates
## Macro has a body: N
##
## Desc:
## Contains the @self variable for pagename.
## I am too lazy to edit pages after creating, just for this one macro edit.
##
## Developed by: aho
## Date created: 2015-04-29
## Installed by: aho, 2015-04-29

## @noparams
<ac:structured-macro ac:name="tasks-report-macro">
  <ac:parameter ac:name="pages">$content.id</ac:parameter>
</ac:structured-macro>

 

We are useing this macro for creating, migrating and editing documents and policies in confluence together with the following macro for creating documents from templates. Feel free to use both of them.

See here

 

For the macro below:

I dont know how to parse the $baseURL correctly, so you got to enter the URL manually, sorry for this. ($paramBaseURL = 'FQDN' <- fill out the variable in the code before useing)

## Macro title # create-site_v4
## Macro has a body # N
## Body processing # Selected body processing option
##
## Developed by # Alexander Horn
## Initial idea from # Seibert Media GmbH (get simple code there)
## Date created # 2014-11-19
## Version of the macro # v4
## Installed by # &lt;whoever&gt;
## Description # Macro to create a page by clicking a button. Configute pre- and suffixes for sitenames, choose templates and spaces and the parent pages for the new site.
## Project context # Change Management with Confluence as CMDB


## Macro
## @param Button:title=Button name|type=string|default=Create Page|desc=Name of the button for page creation
## @param Size:title=Button Size|type=enum|enumValues=inline-block,block|default=inline-block|desc=Choose displayed button size
## Page
## @param PageTitle:title=Pagename dummy|type=string|desc=Dummy name for pages created by this macro. A whitespace will be used, if empty. Plz use prefixes or suffixes in this case.
## @param Prefix:title=Prefix for pagename|type=string|required=false|desc=Prefix to use for pagenames.
## @param PostfixDate:title=Use date as sufffix for pagename|type=boolean|required=false|desc=Date will be set as a sufffix for pagenames. You should choose a date format.
## @param DateFormat:title=Choose date format|type=enum|enumValues=yyyy-MM-dd,yyyy-MM-dd hh:mm,dd. MMM yyyy,dd. MMM yyyy hh:mm|required=false|desc=Date format will be used for suffixes
## @param PostfixParent:title=Use parent site as suffix for pagename|type=boolean|required=false|desc=Parent site will be set as a sufffix for pagename. If used with date, parent page title will be set before date suffix.
## @param PageID:title=Target parent page|type=int|required=false|desc=Select a parent page ID where created pages will be stored as childs. If empty, current page will be assumed.
## @param Template:title=Template|type=int|required=true|desc=Template ID which should be used as framework for created pages.
## @param Key:title=Space-Key|type=spacekey|desc=Choose the space which will be storing the created pages.
## Server
## @param Protocol:title=Protocol type|type=enum|enumValues=http,https|default=https|desc=If SSL used select the "https" value
## @param BaseURL:title=Confluence-URL|type=string|desc=URL of Confluence (should be FQDN?).



&lt;style type="text/css"&gt;
.macrocontent, .macrocontent a:focus, .macrocontent a:hover, .macrocontent a:active {
background: linear-gradient(to bottom, #FFF 0px, #F2F2F2 100%) repeat scroll 0% 0% transparent;
border: 1px solid #CCC;
border-radius: 3.01px;
box-sizing: border-box;
cursor: pointer;
display: $paramSize !important;
font-family: inherit;
font-size: 14px;
font-weight: normal;
height: 2.14286em;
line-height: 1.42857;
margin: 0px;
padding: 4px 10px;
text-shadow: 0px 1px 0px #FFF;
vertical-align: baseline;
white-space: nowrap;
text-decoration: none !important;
color: #333 !important;
font-variant: small-caps; }
&lt;/style&gt;


##
## The default values for your server configuration to speed up the useing of the macro
## Delete this block for first use
## Delete this block if you share this macro. 
#if ( !$paramProtocol)
  #set ( $paramProtocol = 'https' )
#end
#if ( !$paramBaseURL)
  #set ( $paramBaseURL = 'FIXME FQDN HERE' )
#end
#if ( !$paramKey)
  #set ( $paramKey = $space.key )
#end
## End of block for serverconfig
##


## Set current page as parent, if not set by user
#if ( !$paramPageID)
  #set ( $paramPageID = $content.id )
#end

## Set prefix, if parameter Prefix is set by user
#if ( $paramPrefix )
  #set ( $paramPageTitle = $paramPrefix + $paramPageTitle )
#end

## Set default date format, if not set, but postfix option is used
#if ( !$paramDateFormat )
  #set ( $paramDateFormat = 'yyyy-MM-dd' )
#end

## Set postfix set by user
#if ( $paramPostfixParent == true)
  #set ( $paramPageTitle = $paramPageTitle + ' - ' + $content.getTitle() )
#end
#if ( $paramPostfixDate == true)
  #set ( $paramPageTitle = $paramPageTitle + ' - ' + $action.dateFormatter.formatGivenString($paramDateFormat, $content.currentDate) )
#end

## Create the site
&lt;a class="macrocontent" href="$paramProtocol://$paramBaseURL/pages/createpage-entervariables.action?templateId=$paramTemplate&amp;spaceKey=$paramKey&amp;title=$paramPageTitle&amp;newSpaceKey=$paramKey&amp;fromPageId=$paramPageID"&gt;$paramButton&lt;/a&gt;

 

 

Rob Katz April 30, 2015

Thanks! Unfortunately, my deployment of hosted Confluence doesn't include the User Macro option :(

1 vote
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.
December 17, 2014

You can create a user macro as a wrapper to the task report macro that will pass the current page to the task report. See the below link for an example of wrapping a task report macro with a user macro. Instead of swapping out the user parameter though you would be swapping out the page parameter.

https://answers.atlassian.com/questions/10417737

Rob Katz December 17, 2014

Dang! I got super excited until I discovered that I don't have the ability to create a User Macro in the On Demand version of Confluence! :(

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.
December 17, 2014

Yeah, shoot. I don't know another way other than that. That is once of the main reasons I don't like the OnDemand version ... too limited.

1 vote
Rob Katz December 17, 2014

Hi Davin,

 

Thanks for that suggestion. Unfortunately, it doesn't solve my problem as each new page I create from that template would show the Task Report for all other pages created from that template.

 

The ideal solution would be to have a token that I could add to the Task Report macro so that the first filter text box could support something like "@currentPage". 

 

Use Case:

  1. User starts a new page based on template.
  2. User names page
  3. User clicks save

The newly created page would include a Task Report that lists all Incomplete Tasks from that page (would be blank with initial save).

By using a Label, that new page would list Tasks from all other pages with the same Label. So that would be a fail.

Does that make sense?

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.
December 17, 2014

Sorry. I misunderstood the question. See my new answer.

0 votes
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.
November 29, 2017

Add a label to your template that is specific to that template. Every page created from the template will also get the label. Then restrict your task report macro to that label.

0 votes
Anders Bentell April 20, 2016

I am looking for the exact same thing, did you find a solution? (I am also not allowed to create my own macros)

0 votes
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.
December 16, 2014

What you would do is give your template a label and then in the task report macro filter to pages with that label. That should make sure that you only see tasks for pages created with the template.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events