I've got a generic confluence page, e.g. an invitation to work on a Jira issue. The text is kind of a template, but it should be "personalized" by a specific Jira issue, e.g. by adding the Jira macro with a link to this specific issue or by using a specific field value of the Jira issue inside the invitation.
I'm looking for a way to do this by just adding the Jira issue id as a parameter to the link to the confluence page, but without having to create a specific instance of the page for each Jira issue and to change the parameters of the macros inside that page.
Is this possible with on-board tools? Are there addons around which might allow this?
Actually, I could even fetch the Jira issue id from the referrer to the template page, if there is a means to dynamically use the referrer content, maybe by some sort of script?
You could create a user macro that wraps the built-in Jira macro and dynamically edits the JQL for the Jira macro based on the URL query string. Something like this would work. You would need to find out a couple things about your system before creating the user macro. You can do that by putting a Jira macro on your page. with a JQL query like this. Put in a real issue key.
key="{Some Issue Key}"
Once you've saved the page look at the storage format that was created. You can get to that through the Page Menu ->"View Storage Format". Get the server and serverId parameters that were created for the Jira macro. You'll need to put those into the user macro code below. You can create user macros in Confluence Administration -> User Macros. Once you create the user macro you can then put it on a page and access the page like this. The jira macro will change to reflect the query string parameter.
http(s)://{your server}/display/{spacekey}{page name}?issuekey={your issue key}
Macro Name:
dynamic_jira
Macro Title:
Dynamic Jira
Macro Body Processing:
No macro body
Template:
## Developed by: Davin Studer ## Date created: 12/21/2020 ## @noparams #if($req.getParameter('issuekey') && $req.getParameter('issuekey') != "") #set( $issuekey = $req.getParameter('issuekey') ) <ac:structured-macro ac:name="jira" ac:schema-version="1"> <ac:parameter ac:name="server">{Place your server value here}</ac:parameter> <ac:parameter ac:name="columns">key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution</ac:parameter> <ac:parameter ac:name="serverId">{Place your serverId here}</ac:parameter> <ac:parameter ac:name="key">$issuekey</ac:parameter> </ac:structured-macro> #end
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.