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 I specify parameters to use in the Jira Issue/Filter macro, preferably from a combo box?

I have utilized the Jira Issue/Filter macro in Confluence and it is incredibly useful.  However, I would like to be able to populate a few of the parameters within the JQL string dynamically, preferably using a combo box.  While I know that I could create individual filters for each combination, this does not scale well, especially for multiple options.

In the problem I'm addressing, I'm querying based upon assignee and a couple custom fields.  In the combo box, I'd like to have the people's actual full name, such as John Smith, but then when the option is picked, insert their username, such as jsmith.  I also have a statement month and year that I need to similarly translate.  I would like the user to select a month and year, say June in one combo box and 2020 in another, and then translate that to a corresponding date range tied to a custom field in JQL (AND "Purchased Date" > 2020-5-23 AND "Purchased Date" <= 2020-6-22).

I saw the following link, but it requires Scaffolding and Reporting, both of which are expensive: https://docs.servicerocket.com/reporting/user-guides/recipes/miscellaneous/injecting-parameters-into-the-jira-issues-macro

I also saw the Run macro (https://bobswift.atlassian.net/wiki/spaces/RUN/overview), but didn't see how to tie that into Jira.  I found a few similar items, but again, I want to use the values from the combo boxes to inform the JQL string to use in the Jira Issue/Filter macro.

This also seems to limit options such as Easy Dropdown (https://marketplace.atlassian.com/apps/1216797/easy-dropdown-menu-drop-down-selection?hosting=server&tab=overview).  The dropdown options are great, but I don't know how I could then tie the selections into the Jira Issue/Filter macro.

I suspect that I would need to write my own plugin to achieve the desired functionality, but could be missing something obvious.  Any assistance would be greatly appreciated.

2 answers

Hi @Brian_Mihok ,

You may try to use the Table Filter and Charts for Confluence app. 

Wrap you Jira Issues macro in the Table Filter macro and set the required filters:

Jira 1.pngJira 2.pngYou don't need to change your JQL query in the Jira Issues macro - just show all the fields. Regular users will find (filter) everything they need in the view mode easily. 

Jira 3.png

I recently had to do something similar where I have a query that must be used in different but similar Confluence pages. The Jira macro worked fine, but you have to remember which query to use. Quite frankly, I just want the query obfuscated so that all the user had to do was add the new macro and it does what is needed. The Jira project tracks issues of a number of project. There is a field called "Project Name" that provides the project name. We have a Confluence page for each project using the value used in the Jira "Project" field as the page title.

Here's a really simple approach that I came up with wrapping the Jira macro that provides a total of the number of issues found. The query itself simply looks for all unresolved issues or a given project. The value for the "Project Name" field used in the query is derived from $content.title. 

Here's the code.

## Macro title: JQL Total Issues To Date 
## Macro has a body: N
## Categories: Reporting
## Description: Uses the Jira macro to show total issues to date of a project.
##
## @noparams
<ac:structured-macro ac:name="jira" ac:schema-version="1">
<ac:parameter ac:name="server">JIRA</ac:parameter>
<ac:parameter ac:name="jqlQuery">project = MYPROJECT AND resolution = Unresolved AND "Project Name" = $content.title ORDER BY priority DESC, updated DESC </ac:parameter>
<ac:parameter ac:name="count">true</ac:parameter>
ac:parameter ac:name="serverId">9d3b3c3f-d5c9-38fa-b19f-fabc967a7dc3</ac:parameter>
</ac:structured-macro>

For your needs, you can add the necessary parameters the user can fill out and use the entered values to build the query. The changed macro would look like the following if I chose to prompt the user for the project name (the changed lines are italicized):

## Macro title: JQL Total Issues To Date 
## Macro has a body: N
## Categories: Reporting
## Description: Uses the Jira macro to show total issues to date of a project.
##
## @param projectname:title=Project Name|type=string|required=true|desc=The project name
<ac:structured-macro ac:name="jira" ac:schema-version="1">
<ac:parameter ac:name="server">JIRA</ac:parameter>
<ac:parameter ac:name="jqlQuery">project = MYPROJECT AND resolution = Unresolved AND "Project Name" = $paramprojectname ORDER BY priority DESC, updated DESC </ac:parameter>
<ac:parameter ac:name="count">true</ac:parameter>
ac:parameter ac:name="serverId">9d3b3c3f-d5c9-38fa-b19f-fabc967a7dc3</ac:parameter>
</ac:structured-macro>

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...

125 views 0 3
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