Execute Dynamic JIra query from confluence cloud
Asked by Sanju Nair:

Hi ,

We have JIRA and Confluence Cloud versions.

Im using JIRA issue macros to display all the tickets in sprint.

From Confleunce Cloud , how can I execute a dynamic JIRA query with parameters that i can set outside of the query ?

i.e instead of hardcoding the sprint id in a query like "Sprint=521 and issuetype=story" can i first set the value for a parameter in confluence as ActiveSprint=521 and then run the query to dynamically pick the value for sprint at the time of execution like 'Sprint=$ActiveSprint$ and issuetype=Story' ?

Today I have almost 40 queries in a dashboard that i need to update everyu 2 weeks with new sprint id.

Im open to using 3rd party add ons as well.

I googled abt this and all i could find was answers for Confluence server and not Confluence cloud.

-Sanju


Answers:
author: Ora Zyto
body: Same problem here! Trying to create snapshots of product requirements for individual releases (fixVersion field in Jira), for separate components.

I would love to be able to use Confluence variables and directly inject them in a given Jira macro table.

Is it possible at all in Jira / Confluence Cloud?


author: Sam Hall
body: Hi Sanji - You could try using the [openSprints()](https://confluence.atlassian.com/jirasoftwarecloud/advanced-searching-functions-reference-764478342.html#Advancedsearching-functionsreference-openSprintsopenSprints()) search function in the JQL queries in your issue macros:

```
issuetype = story AND sprint in openSprints()
```

This should return a list of stories in your current active sprint(s), so you don't need to change the sprint ID every time.

This will only display issues in an active sprint, so issues allocated to a sprint which has not yet started won't be displayed.

comments: author: Sam Hall
body: Another option would be to save a filter in JIRA which returns all issues in a particular sprint:

```
Sprint = 521
```

Note the filter id when you save it, then you can refer to this saved filter in your 40 queries.

For example, if the filter ID of the search above is 10200, you can do the following to display all stories in sprint 521:

```
filter = 10200 AND issuetype = story
```

And the following to display all bugs:

```
filter = 10200 AND issuetype = bug
```

Doing this means you only have to update the sprint ID in one place to change the results of all 40 queries that refer to it.


author: Sanju Nair
body: Thanks a lot for the quick response Sam !!

The example I gave was to explain the usage of a variable in the query.

Let me explain my real issue:

- Need to show the scope of whole year in current sprint(S), next sprint(S), next month(M), month after(M), Quarter(Q) Half (H)

i.e SSMMQH

Our sprints are 2 weeks each

The way im doing it now is by 1 jira query for each.

i.e 1 query for current sprint

1query for next sprint

1 query for next month (actually the 2 sprints for that month)

etc for rest of the MQH

All the above ive create a table in confluence page with 6 columns and each results are shown in seperate columns using jiraissues macro.

Now this is for just 1 product with its own board and sprints (Sprint ids)

I have to create 12 wiki pages for each products (meaning i have to replicate the queries with product and sprintid's deifferent)

Our cross functional teams and management were pretty happy with this dashboard (since they werent getting any visibility to Engineering plans), but now comes the problem of scaling it maintaining it.

If I had the option to run the query based on runtime parameters, then I could have setup the data in a seperate location where i just have to change the values.

Im open to any other option to report the same content even 3rd party tools either in confluence cloud or jira cloud.

-Sanju


Tags: confluence-cloud

developer

jira-cloud