Hi,
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.
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
## http://velocity.apache.org/engine/1.7/user-guide.html
##
## 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(""<p>","""))
#set ($body = $body.replaceAll("</p>"","""))
#set ($body = $body.replaceAll("\Q<p>\E"," "))
#set ($body = $body.replaceAll("\Q</p>\E"," "))
#set ($body = $body.replaceAll(""<span>","""))
#set ($body = $body.replaceAll("</span>"","""))
#set ($body = $body.replaceAll("\Q<span>\E"," "))
#set ($body = $body.replaceAll("\Q</span>\E"," "))
#set ($body = $body.replaceAll(""<pre>","""))
#set ($body = $body.replaceAll("</pre>"","""))
#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())
<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">ff94f833-c264-3d1f-a236-7bdb5d13106c</ac:parameter>
</ac:structured-macro>
</p>
#if ($paramdisplayJQL=="true")
<ac:structured-macro ac:macro-id="94f6dacf-19a6-4679-ab0b-4052266a6b47" ac:name="info" ac:schema-version="1">
<ac:rich-text-body>
<p>$body</p>
</ac:rich-text-body>
</ac:structured-macro>
<br/>
#end
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
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.
Regards,
Shannon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Shannon S
Thanks for your feedback.
My goal is to create a page with Jira table based on differents JQL and where the information are differents :
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 :
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Regards,
Shannon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I'm trying to do something very similar, however we use Confluence Cloud version, can this be done please?
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.