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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Confluence groovy script or macro to pull linked jira issue key and summary

I need help finding information for confluence groovy scripting.

When a confluence page is linked to a Jira issue this button shows up on the page


Within Confluence can I use groovy to get the Issue key and summary to display a text field or Jira link macro?

I would like to be able to see the Jira linked issues listed out like the card here when you click the Jira link button above





2 answers

0 votes
Florian Bonniec Community Leader Jul 19, 2022

Hi @SJ 

The only way I found to achieve that is to do a REST Call to get this information.
The endpoint to use from Confluence is "/rest/jira-metadata/1.0/metadata?pageId="

It will return a JSON with "groups", one of them is of type Issues and list all issues linked to the page.



0 votes
Craig Nodwell Community Leader Mar 17, 2022

This might be a bit complicated but you should be able to accomplish this, although I think you need to break down your requirements a bit. 
Ex: How are the links being made? re: Jira macro, Confluence Link in Jira Issue, URL copy/paste into Confluence page.
It has been my experience when publishing Jira data into confluence it is easier to push from Jira than to pull from confluence.  With that in mind., you'll need to setup a listener, use your application links for access, listen for when new links are created, validate to ensure the links are of type confluence, get the space & page id, formulate your content, publish.
Now on the other side you could create a custom macro/listener combo to pull the data and publish an update based on the first existence or edit of a Jira link, I think the easiest way to do that would be via the scriptrunner plugin and setup a rest endpoint or resource to the jira database to feed into the custom macro.
I have some script examples that could get you going depending on the course of action you wish to take but keep in mind this will not be easy and will have a maintenance overhead.

Here's a bit more detail

We use AutoPage in Jira to create Confluence documentation pages for specific issue types.  That is how the Confluence links are created. 

This Icon/button is dynamically rendered at the top of a page if that page is linked to by a Jira Issue and is built in Confluence functionality

I'm looking for a Confluence macro/script to show me all the Jira Issues that reference that Confluence page.

Like Craig Nodwell likes this
Craig Nodwell Community Leader Mar 17, 2022

I don't have experience with that plugin, however the documentation shows it's very customizable as to what gets published.  Maybe you might want to explore that a bit more if possible, re: maybe a second publish with different details(template) based on the initial publish....

Quick question, do these get published to a singular page? or individual pages? just wondering based on your last sentence.  The answers may help with further breaking down requirements.

(Edited for clarity)

We use autopage to create single doc pages from Jira as well as multipage hierarchies.

How the Confluence pages are created shouldn't make much difference. The fact the page is linked in a Jira issue and somehow a Confluence page knows to display this icon image.pngwhen that link exists. 

I want to be able to expand that connection to get and display a bit more information about the Jira issues referencing the confluence page.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events