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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • 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

Means to dynamically "parametrize" pages?

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?

1 answer

0 votes
Davin Studer Community Leader Dec 21, 2020

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

187 views 0 6
Read article

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