Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • 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

Would like to get a value from a table to insert it into other macros


I would like to know if it's possible to get the value from a place in a page (title, page properties, table...) and update others macros with this value (example : Jira macro).


Usage :  I use Confluence for a dev team and we use in differents places Jira macros with always the same key. So instead of repeat the key number in each macro, I would like to create a template with a wizard and when we create the page, we insert the jira key in a single place, insert informations at the differents others places and then when I publish my page, the macro will show the correct information based on the key introduce in a single place.

In advance, thx for your help.

2 answers

2 votes
Dominic Lagger Community Leader Jan 13, 2020

Hi @Guillaume Lorquet 

We had to find a solution for a similar problem. We have more than 10 JIRA filters for checking our release. And on each of these filters, we have to change the "fixVersion" every single time, we release, in more than 10 JIRA macros... 

So we made a user macro, where you just have to search & replace the "fixVersion".

The user macro looks like this:

## Macro title: JQL Query in Body
## Macro has a body: Y
## Body processing: Rendered
## Output: JIRA Issues based on Jira Macro
## User Macros laufen auf der Apache Velocity Engine
## Modified:

## This macro can be used with injected template-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=type,key,summary,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
## @param displayJQL:title=Display JQL|type=boolean|required=true|default=false|desc=Displays the JQL in an Info Box under the Result Table
#set ($body = $body.replaceAll("&quot;<p>","&quot;"))
#set ($body = $body.replaceAll("</p>&quot;","&quot;"))
#set ($body = $body.replaceAll("\Q<p>\E"," "))
#set ($body = $body.replaceAll("\Q</p>\E"," "))

#set ($body = $body.replaceAll("&quot;<span>","&quot;"))
#set ($body = $body.replaceAll("</span>&quot;","&quot;"))
#set ($body = $body.replaceAll("\Q<span>\E"," "))
#set ($body = $body.replaceAll("\Q</span>\E"," "))

#set ($body = $body.replaceAll("&quot;<pre>","&quot;"))
#set ($body = $body.replaceAll("</pre>&quot;","&quot;"))
#set ($body = $body.replaceAll("\Q<pre>\E",""))
#set ($body = $body.replaceAll("\Q</pre>\E",""))

#set ($body = $body.replaceAll("\Q<br/>\E"," "))

#set ($body = $body.trim())
<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">ff94f833-c264-3d1f-a236-7bdb5d13106c</ac:parameter>

#if ($paramdisplayJQL=="true")
<ac:structured-macro ac:macro-id="94f6dacf-19a6-4679-ab0b-4052266a6b47" ac:name="info" ac:schema-version="1">

So you can set your JQL and it's shown in the edit mode. Therfore you just have to search & replace your issue number.

Hope this helps.

Regards, Dominic

0 votes

Hello Guillaume,

Thank you for contacting us.

Variables can be set only on a specific template, but you can't re-use that variable elsewhere. 

Can you help me to understand what you're attempting to do exactly? From my understanding, you want to place the same Jira macro over and over again? It might be easier for you to create a search filter on the Jira end, and that way, when you go to insert the Jira issues macro, you can just recall the same filter.

Let me know if you have any questions about that.



Hi @Shannon Spaniol

Thanks for your feedback.

My goal is to create a page with Jira table based on differents JQL and where the information are differents :

  1. Jira Macro as "Single issue" : Based on JQL "KEY = KEY-111" and content key, summary and status.
  2. Jira Macro as "Table" : Based on JQL "KEY = KEY-111" and content description of the issue.
  3. Jira Macro as "Table" : Based on JQL "parent = KEY-111" and content description of the issue.

So, I would like to insert in a place the "KEY-111" and then all the different macro will be automatically populated at page creation.

I wanted to use template, insert variable and use them in the "Jira macros".

Example in print screen :

  1. Create a page from a template.
  2. Insert the issue key in a variable
  3. The table is filled based on JQL in the macro that get the "jira.issue" variable.
  4. A table get the issue sub-tasks.


Hello Guillaume,

Thank you for explaining your requirements.

Since you are using Confluence Server, you could do this with a user macro.

There are a few threads below where users had similar requirements and they created a user macro for this:

Have a look there, as it may be able to help you with your requirements. 



Hi, I'm trying to do something very similar, however we use Confluence Cloud version, can this be done please?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

342 views 23 8
Join discussion

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