Can I specify parameters to use in the Jira Issue/Filter macro, preferably from a combo box?
Asked by Brian_Mihok:

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


Answers:
author: Katerina Kovriga {Stiltsoft}
body: Hi [@Brian_Mihok](/t5/user/viewprofilepage/user-id/3970253) ,

You may try to use the [Table Filter and Charts for Confluence](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=server&tab=overview) app.

Wrap you Jira Issues macro in the [Table Filter](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Filter+macro) macro and set the required filters:

![Jira 1.png](https://community.atlassian.com/t5/image/serverpage/image-id/112597iFFEC96B08C92C1D6/image-size/large?v=v2&px=999 "Jira 1.png")![Jira 2.png](https://community.atlassian.com/t5/image/serverpage/image-id/112598i5CD638A9F4B1FA39/image-size/large?v=v2&px=999 "Jira 2.png")You 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](https://community.atlassian.com/t5/image/serverpage/image-id/112600i8B80B0EFC91CAF1E/image-size/large?v=v2&px=999 "Jira 3.png")


author: Balu Wagle
body: Hello [@t3knoid](/t5/user/viewprofilepage/user-id/787600)

Sorry to revive this old post.

This is very helpful. I had one question though.

My project name has multiple words separated by spaces so in the jql I have to put double quotes around the name so this does not seem to worhk without the double quotes.

is there a way to add those around the $content.title ? I tried adding them directly around the $content.title but then is seems to take the actual string and not the evaluated value


author: t3knoid
body: 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>
```

comments: author: Balu Wagle
body: Hello [@t3knoid](/t5/user/viewprofilepage/user-id/787600)

Sorry to revive this old post.

This is very helpful. I had one question though

My project name has multiple words separated by spaces so in the jql I have to put double quotes around the name so this does not seem to worhk without the double quotes.

is there a way to add those around the $content.title ? I tried adding them directly around the $content.title but then is seems to take the actual string and not the evaluated value


Tags: confluence-server

server