Injecting Parameters into the Jira Issues Macro

Scenario

The following recipe shows how to inject parameters into Atlassian's Jira Issue macro. Wiki Markup must be used as the macro auto-complete does not read the injection.

Both Scaffolding and Reporting must be installed with a connection between Confluence and Jira.

Result

Recipe

Apps

Scaffolding Forms & Templates for Confluence Server and Data Center, Reporting for Confluence Server & Data Center

Apps

Scaffolding Forms & Templates for Confluence Server and Data Center, Reporting for Confluence Server & Data Center

Level

Advanced

Estimated time

15 minutes

Macros

Report On

Suppliers

 

Storage format

You can copy and paste this code into the Confluence Source Editor:

<p>Project:</p> <ac:structured-macro ac:macro-id="f8d910e0-a27a-4843-b07b-27b65eeb4382" ac:name="text-data" ac:schema-version="1"> <ac:parameter ac:name="name">ProjectName</ac:parameter> <ac:parameter ac:name="content">text</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <p> <br /> </p> </ac:rich-text-body> </ac:structured-macro> <p> <br /> Start:</p> <ac:structured-macro ac:macro-id="91ce2742-67ec-4045-a02a-25b3adbba42b" ac:name="date-data" ac:schema-version="1"> <ac:parameter ac:name="name">SprintStart</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> </ac:structured-macro> <p> <br /> End:</p> <ac:structured-macro ac:macro-id="b51b50cd-3a72-483e-8b6c-14be8a2b823f" ac:name="date-data" ac:schema-version="1"> <ac:parameter ac:name="name">SprintEnd</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p> <ac:structured-macro ac:macro-id="b8518e14-916a-4136-a6b7-9bde65fbe7df" ac:name="report-on" ac:schema-version="1"> <ac:parameter ac:name="injected">true</ac:parameter> <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter> <ac:rich-text-body> <ac:structured-macro ac:macro-id="491e8898-a643-4bee-b521-d4971c23ed0d" ac:name="jiraissues" ac:schema-version="1"> <ac:parameter ac:name="jqlQuery">project = %data:ProjectName% AND resolved &gt; %data:SprintStart&gt;date:yyyy-MM-dd% AND resolved &lt; %data:SprintEnd&gt;date:yyyy-MM-dd% ORDER BY priority DESC</ac:parameter> </ac:structured-macro> </ac:rich-text-body> </ac:structured-macro> <p class="auto-cursor-target"> <br /> </p>

Macro structure

You can recreate the example in the editor view:

Steps

  1. Create a Text Data macro.
    Give it a Field Name of "ProjectName".
    Change the Content Type to "Text".

  2. Create a Date Data macro.
    Give it a Field Name of "SprintStart".

  3. Create another Date Data macro.
    Give it a Field Name of "SprintEnd".

  4. Create a Report On macro.
    Ensure the Injected parameter is true.

  5. Within the Report On macro, create a Jira Issues macro.
    Enter a JQL query into the Search field.
    In this example, the query used is:

    project = %data:ProjectName% AND resolved > %data:SprintStart>date:yyyy-MM-dd% AND resolved < %data:SprintEnd>date:yyyy-MM-dd% ORDER BY priority DESC