How to automate updating of JIRA filters/query on Confluence page
Asked by Oana:

Hello everyone,

We have our Confluence page for each step of a sprint and this page needs to be updated every sprint with the sprint related stories.

The team, usually updates the Jira query or filter manually when editing the Confluence page each sprint. The issue is that this is a manual process prone to human error. I have pasted bellow How the page usually looks once all the data is pulled from JIRA.

My idea was to write a script, not sure in which language or how to link it to both Confluence and JIRA, haven't written scripts at all.

These are the steps that I have identified on what the script should update:

1. For project is CLOUD and issuetype is STORY change currentFixVersion from ... to ... and nextFixVersion from ... to ...

This is our current JIRA query:

project = PROJECT NAME AND issuetype = Story AND fixVersion in (S4.3.20, S4.3.20DF, S4.3.20FT, S4.4.20, S4.4.20DF, S4.4.20FT) AND fixVersion not in (S4.2.20FT, S4.5.20DF, S4.6.20DF, S5.1.20DF,S5.2.20DF) AND ("Lead Countries" = "COUNTRY NAME" OR "Other Countries" in (COUNTRY NAME AND ALL)) AND (COUNTRY NAME != "Not Applicable")

![Confluence_JIRA_Filters_Query1.jpg](/t5/image/serverpage/image-id/119291i04EE91FAFE523DEF/image-size/large?v=v2&px=999 "Confluence_JIRA_Filters_Query1.jpg")

Thank you for your help and please ask any questions that might make this clearer.


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

We can suggest trying our app - [Table Filter and Charts for Confluence](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=server&tab=overview).

Use the most simple JQL query for your Jira Issues macro (such as "project = qwerty") and wrap the macro into the [Table Filter](https://docs.stiltsoft.com/display/public/TFAC/How+to+use+Table+Filter+macro) macro body.

You'll be able to filter (and save the results!) in the page view mode using a friendly Excel-like interface:

![Mon 1-1.png](https://community.atlassian.com/t5/image/serverpage/image-id/119316i2424B3C4492B8BEA/image-size/large?v=v2&px=999 "Mon 1-1.png")The Table Filter macro provides different kinds of filters: dropdown, date range, icon etc. as well as reversed filters to get the most accurate result.

comments: author: Oana
body: Hi [@Katerina Kovriga {Stiltsoft}](/t5/user/viewprofilepage/user-id/1464746) ,

Thank you for your answer.

This seems to be a paid solution, correct?

I am interested in something that I can do by myself before looking into paid solutions.

Would this work with the free version?

Thank you ,

Oana


author: Katerina Kovriga {Stiltsoft}
body: Yes, it's a paid app: filtering is only one part of the available functions. The addon supports Cloud/Server/DC and provides Excel-like features (pivots, table calculations, conditional formatting, table merging, pagination, various kinds of charts based on static and dynamic data, import/export to CSV, etc.).

It may come in handy if you use a lot of tables in Confluence (both manually created and automatically generated by such table macros as Jira Issues, Page Properties Report, etc.). So feel free to give it a try - you'll have one month to explore all the features with an evaluation license.


author: Oana
body: Thank you [@Katerina Kovriga {Stiltsoft}](/t5/user/viewprofilepage/user-id/1464746) this seems interesting and useful but I am looking for something different.

Hope to get a bit more answers and help.

Oana


author: Oscar
body: Hi [@Oana](/t5/user/viewprofilepage/user-id/4170437)

I have been working on a similar area. Our aim is to automate the creation of confluence pages and include the Jira's that are linked to the page.

So far I have this string which I append to the end of a HTML I intend to post to confluence via powershell.

"\<ac:structured-macro ac:name=\\""jira\\"" ac:schema-version=\\""1\\"" ac:macro-id=\\""4cb87cc3-eac8-4e8d-85c4-72322671662a\\""\>  
\<ac:parameter ac:name=\\""server\\""\>Admiral IT Jira\</ac:parameter\>  
\<ac:parameter ac:name=\\""columnIds\\""\>issuekey,summary,issuetype,created,updated,assignee,status\</ac:parameter\>  
\<ac:parameter ac:name=\\""columns\\""\>key,summary,type,created,updated,assignee,status\</ac:parameter\>  
\<ac:parameter ac:name=\\""maximumIssues\\""\>20\</ac:parameter\>  
\<ac:parameter ac:name=\\""jqlQuery\\""\>summary \~ \&quot;$($PageTitle)\&quot; OR labels =\&quot;$($PageTitle)\&quot;\</ac:parameter\>  
\<ac:parameter ac:name=\\""serverId\\""\>\*MASKED\*  
\</ac:parameter\>\</ac:structured-macro\>"

Here we are using a JQL query within the Jira macro. However, the issue we are facing is \<ac:structured-macro ac:name=\\""jira\\"" ac:schema-version=\\""1\\"" ac:macro-id=\\""4cb87cc3-eac8-4e8d-85c4-72322671662a\\""\> (The first line from above). The ac:macro-id is taken from an existing page and I suspect this is the problem because they are unique.

This link:  
<https://community.atlassian.com/t5/Confluence-questions/What-is-the-purpose-of-ac-macro-id-Can-it-be-omitted-from-User/qaq-p/799325>  
provided some explanation but omitting the Id failed too.  
This comment may help your work and if anyone else can provide more info thanks!


Tags: confluence-server

filter

jira

server