I am building a standard project dashboard for our development projects in Confluence. We use JIRA for tracking, essentially, ANYthing that moves during development. I would like to avoid, when building the template, having to manually create the JIRA queries common to all projects over and over but differing only, for example the JIRA key. With Bob Smith's help, I've been able to use page metadata values I've set to substitute search parameters in SQL queries to suck in project accounting information. I'd like to do the same with JIRA for a variety of issue displays in the dashboard. In detail:
I use the metadata 2 plugin to set page metadata values with the following:
{metadata-list} | projectcode | A1234 | | jirakey | BOBO | {metadata-list}
In the SQL queries, I've been able to use:
select actual from gates where project_code = '{metadata-from:projectcode}' and gate = 'S4'
I want to do the same with the JQL queries; for example:
project = {metadata-from:jirakey} and status != closed
However, when I put this in the JIRA issues macro, It simply reads that as entered and, surprise surprise, the query doesn't work.
Any thoughts on how to use metadata (or any other kind of variable substitution) on an issue query made from Confluence?
I figured since we solved this recently, i would add our official solution to this request which allows to inject any number of variables into any JQL filter in a Confluence Template. Below is the how-to as well as some usage notes i wrote for our company:
First we start out with determining the current syntax of the JQL Issues/Filter macro in confluence:
Copy the JIRA Issue/Filter macro syntax to a text editor, e.g.
<p> <ac:structured-macro ac:macro-id="5a45704b-a904-4440-bdc0-da68a22d5802" ac:name="jira" ac:schema-version="1"> <ac:parameter ac:name="server">JIRA</ac:parameter> <ac:parameter ac:name="columns">key,summary,type,created</ac:parameter> <ac:parameter ac:name="maximumIssues">20</ac:parameter> <ac:parameter ac:name="jqlQuery">assignee = abarylak and resolution is EMPTY </ac:parameter> <ac:parameter ac:name="serverId">c8001771-0b52-30e0-9703-562a2820710f</ac:parameter> </ac:structured-macro> </p>
Then we need to use the above syntax (a little modified) and use that for our macro.
Results are as follows:
## Macro title: JQL Filter Allowing Variables ## Macro has a body: Y ## Body processing: Rendered ## Output: JIRA Issues/Filter Macro w/ injected variables ## ## Developed by: Adam Barylak ## Date created: 2016-05-27 ## Installed by: Adam Barylak ## This macro will prompt for max number of rows and the column option, then the body will require the JQL with injected variables ## @param maxRows:title=Max Rows|type=int|required=true|default=20|desc=Enter the max rows, anything above 1000 will only display 1000 rows. ## @param columns:title=Columns|type=string|required=true|default=key,summary,type,status,assignee|desc=Enter the columns you want returned. Must be separated by commas, all lowercase, and no quotes. e.g. key,summary,assignee,test author,reporter #set ($body = $body.replaceAll("\Q<p>\E","")) #set ($body = $body.replaceAll("\Q</p>\E","")) #set ($body = $body.trim()) <p> <ac:structured-macro ac:name="jira" ac:schema-version="1"> <ac:parameter ac:name="server">JIRA</ac:parameter> <ac:parameter ac:name="columns">$paramcolumns</ac:parameter> <ac:parameter ac:name="maximumIssues">$parammaxRows</ac:parameter> <ac:parameter ac:name="jqlQuery">$body</ac:parameter> <ac:parameter ac:name="serverId">c8001771-0b52-30e0-9703-562a2820710f</ac:parameter> </ac:structured-macro> </p>
Create the macro in confluence with the following options or similar (change as needed):
Hopefully this helps others accomplish this same task. This ends up being really useful if you need to repeat a bunch of JQL filters for different things on different pages in Confluence and you don't have to store these filters as saved filters in JIRA either.
Try my reponse a long with Dougs: https://answers.atlassian.com/questions/152208
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I haven't tried this, but here are a couple of suggestions:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bob. For the nonce, I had to get it the templates out the door and the JIRA queries are manually built by the person implementing the template. However, I've structured how the dashboards work so that they can be just killed and reapplied to the various projects when a new version is developed so I'll keep working on that. I did muck about a BIT with the storage editor and didn't have success but haven't exhausted all possiblities there yet. I did also look at your wiki macro, CLI, and scripting as possible vehicles to a solution. When I get this nailed, I'll post back the solution I find with your suggestions here. mike
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Found a solution that works: https://docs.servicerocket.com/display/REP/Injecting+Parameters+into+the+JIRA+Issues+Macro
The trick was to insert it as wiki markup. Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I try the solution with Scaffolding and Reporting for Confluence as mentioned in the link : https://docs.servicerocket.com/display/REP/Injecting+Parameters+into+the+JIRA+Issues+Macro
I try to recreate the example in the editor view but I have a problem when I insert the JIRA issue macro : when I insert the very simple request : project = %data:ProjectName% in the JQL search field, I have an error message explaining me JIRA server hasn't understood the request.
I don't understand the trick with wiki markup. Where do I have to add a wiki markup macro in the editor view ?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.