How to embed Confluence Content in JIRA issue or vice-versa?

I'm trying to find plugins or macros which will allow embedding of Confluence content inside a description field in JIRA, or how to embed specific fields from a JIRA issue into a Confluence page, or both. If anyone has any suggestions, that would be great. Thanks.

16 answers

Works in :

  • confluence 5.5
  • JIRA 6.2

Used plugins (both are free):

  • script runner 2.1.1.17 (needed for script field)
  • JIRA suite utilities 1.4.9 (needed for workflow post function)

Background:

In my company there was a need to integrate JIRA issues with confluence pages in a way that would allow contextual display of confluence pages within JIRA issues depending on status. This was needed for customer support agents so that they can see relevant article, know-how, pictures or specification from confluence depending on the workflow step in jira. The solution is based on the solution proposed by @Ben De Pauw. It is slightly changed so that "script field" is automatically updated by using "update custom field" post function on transition. 

Requirements:

  • script field field with following content

    import com.atlassian.jira.component.ComponentAccessor
     
    String url = getCustomFieldValue('Confluence URL');
     
    // construct url
    if (url?.length() > 0) {
    return "<style> #outerdiv{width:620px;height:300px;overflow:hidden;position:relative;}#main-content{position:absolute;top:-374px;left:-400px;width:1300px;height:1500px;}</style><div id=\"outerdiv\"><iframe src=\"" + url + "\" id=\"main-content\" scrolling=\"no\"></iframe></div>";
    }
     
    return url;
  • custom field of type url named "Confluence URL"
  • post function on every needed transition so that "Confluence url" is updated with url for needed confluence page

How to:

  • Create needed fields
  • Edit Script field and enter code block from above
  • Edit workflow so that url field is updated with needed confluence url depending on transition post function.
  • Test display of script field (confluence content is displayed within this field) by creating issue and looking whether the content is displayed properly. I initially wanted to use javascript to fetch only needed div by id from confluence and display it within JIRA issue but it seemed to complicated. Here you can edit position of displayed confluence content by adjusting position:

    {position:absolute;top:-374px;left:-400px;width:1300px;height:1500px;}

    and fixing it with 

    scrolling=\"no\"

    Here you basically display entire confluence page within iframe and position it depending on your need so that visible part within iframe shows exactly what you want . smile  

 

 

Ben and Delisa Thanks for your work around. I was able to apply it in my test instance with alignment adjustment and enabling scroll to use max space in view issue screen. Is there any way to show the page in Description tab in View issue screen? "<style> #outerdiv{width:635px;height:400px;overflow:scroll;position:relative;}#main-content{position:absolute;top:0px;right:-670px;width:1300px;height:500px;}</style><div id=\"outerdiv\"><iframe src=\"" + url + "\" id=\"main-content\" scrolling=\"yes\"></iframe></div>";

Hi Delisa,
It is not showing the content. i am using
JIRA:- 7.0.2
Script Runner:- 4.3.0

Confluence:- 5.9.1

Does a content retrieval from a different source work?
I can retrieve content from a 'normal' website (google for instance, or our company website) just fine, but the Confluence content seems to be problematic. 

This is caused by the following security change:
https://confluence.atlassian.com/confkb/confluence-page-does-not-display-in-an-iframe-827335781.html
 

Hey Edwin,

You ever figure out how to get this working without having to disable this security setting? Seems like something that would not be acceptable in a production environment. Your solution is the only one I have encountered though that comes close to what I want to achieve so just wondering. Thanks for your time!

Hi Luba,

No, not out of the box. You could try running Jira and Confluence with the same 'start' URL (so www.domain.com/jira and www.domain.com/confluence). That seems to help in some cases.


According to my understanding, to add a Jira issue to a Confluence page, you can use this followng macro as explained in this documenation:

https://confluence.atlassian.com/display/DOC/JIRA+Issues+Macro

Cheers,

Bernardo

Your comment is way off - we are talking Confluence content > Jira, not the other way around.

Bill, I was googling for same problem and found this thread. I want to share our use case with you for better understanding. We have Jira+Confluence installed in-house.

The goal is: to have single point of reference (product feature specification). Discussion and versioning of the requirements are better to perform in Confluence, because of richness of the editor and wiki system as a whole. In the same time, work breakdown should be done in Jira, where we have Feature, Story and Task issue types. Problem is to map writings done in Confluence with descriptions of smaller work pieces which are Jira issues.

My other idea was to have Feature and Story Jira types to be entered, then in Confluence page to have some macros that will pull Description and Estimate fields out the Jira Issue, making actual description text and numbers appear on Confluence page. I'm talking about having macros like jira:TEST-1|field=description - or something similar.

Thank you!

Totally aggreed from my side with last comment. As developper, I use Jira to make Epics from Confluence-edited specification...But I don't like to copy paste.

That's why I'd appreciate to get access to the excerpt macro from within an issue, thus not freezing specification state for the User-stories in-it and get a live backlog coupled with specifications in the backyard !

Finally managed to work out a solution via 2 custom fields & the script runner plugin.

  • Canvas URL: type 'URL Field', editable
  • Canvas Preview: type 'Script Field' (read-only), output type 'HTML'

The user can specify a URL in the Canvas URL field; the Canvas Preview script reads the 'Canvas URL' value & wraps it in html to render the contents within the field. Some extra CSS changes are included to force bigger height & width on the contained CSS element.

Sample Script Code

import com.atlassian.jira.component.ComponentAccessor

String url = getCustomFieldValue('Canvas URL');

// construct url
if (url?.length() &gt; 0) {
    return "&lt;iframe height=\"100%\" width=\"100%\" scrolling=\"auto\" frameborder=\"0\" src=\"" + url + "\"&gt;&lt;/iframe&gt; &lt;script type=\"text/javascript\"&gt;theContent = document.getElementById(\"customfield_13341-val\"); theContent.style.width = \"100%\"; theContent.style.height = \"1000px\"; theContent.style.overflow = \"scroll\"; &lt;/script&gt;";
}

return url;

Note that 'customfield_13341-val' is the CSS element that represents the 'Preview Canvas' field on-screen -> to be adjusted to the custom field ID for the 'script field' on your system

Embedding in issue description

wrap iframe with URL in {html} tags

I know it has been a very long time since this was posted, but there's always hope that someone will see this. We have tried to implement these changes in our tests as well, but the script field that is supposed to show our confluence page is showing up as blank and we can't work out why. The code all seems fine, is there some permissions change we need to make in order to allow it to work?

Hi @Ben De Pauw,
It is not showing the content. i am using
JIRA:- 7.0.2
Script Runner:- 4.3.0

Confluence:- 5.9.1

I am not the Project or Product manager for our company, i'm just the one that solves the problems presented with our current processes. So, with that, this is what we are truly after in the end.

  • Features (Requirements) to be written and stored in Confluence
  • Ability to pull metrics per Feature from JIRA Issues (e.g. roll-up of time worked, estimated time remaining, etc.)
    • This is where embeding content from Confluence into the JIRA issue comes into play
    • They don't want to have to duplicate their requirements writing in 2 systems, but also want to make it easier on the Developer so that they have minimal clicks and hopefully stay within JIRA to see the details of the Feature/Requirement
    • Plan would be to have all Development tasks as sub-tasks under the Feature

So, with those requirements, we were investigating the possibility of finding a macro which would work much like the currently available macros inside Confluence which let you embed content from other pages into a single page. That way the content can be managed in confluence and organized correctly while the JIRA issue can be managing the tasks and time while also keeping updated with the correct content from Confluence.

That is pretty much the basic end goal of this process. It mainly revolves around easier reportability and ease of use for the developers looking at the tasks assigned to them related to the features/requirements.

Let me know if you have any other questions. Thanks.

Yes, guys please add it

I have the simlar problem:

1. Creating business requirements in Confluence.

2. Elaborate on them, discuss with business stakeholders, etc.

3. When it's done - want to reflect it in JIRA User Story... but it's Impossible..

So need to copy/paste all the stuff from Confl page to JIRA or jsut paste link to the Confl. page in JIRA ticket. Both options are not very convinient.

So please add feature of JIRA/Confluence "interchange" the way I described above.

Hi voland,

i definitely agree that, ideally, this would/should be a standard integration feature between confluence & jira.

However, i did find a workaround to resolve the exact same problem you're describing: i solved this by adding 2 custom fields on a JIRA issue: one to store a URL (the confluence page) and one to pull the URLs content & present it within an iframe.

This effectively displays the confluence content within a JIRA issue.
For styling/usability purposes, I've put the 2 fields on a separate tab page in the issue screens & overrule some CSS to ensure it takes more screen space than the default.

You might want to give this a try; if you need any assistance, i'd gladly help out.

Good luck,

Ben

Hi Ben, This is a great idea that my organization would like to try out. I've managed to set up the custom fields and get them to show up in the Jira issue, but they are displayed in the Details section when viewing the issue. As a result the iframe is autosized to a very small area. You said that you put the fields on a separate tab page in the issues screen, but I can't seem to get this to work. I can add a tab in the edit/actions screens, but I don't see a way to add it in the view screen. Could you elaborate on how you added the new tab so that it can been seen when viewing an issue? Thanks, Tom

I've read the answers below but this is still way too hard to do.  I want to be able to use Confluence to work collaboratively with colleagues to document requirements in Confluence and then generate a JIRA issue from the Confluence content in such a way that updates to Confluence are automatically reflected in JIRA.

I love the create JIRA macro in Confluence to create the initial JIRA ticket but instead of just copying and pasting content into the JIRA description what we need is an embedded macro in JIRA that renders just the selected content from Confluence via a link.

What would also be great would be an automatic comment appearing in JIRA when the associated content in Confluence was updated smile

Currently I've embedded a link in my JIRA description to an anchored location on my Confluence page - this kind of works but is both time consuming to implement and far from ideal for users accessing JIRA.

tony did you ever figure this out?  

ultimiately I'm finding that JIRA doesn't support my user requirement needs: doesn't allow enough visual room for constructing and reading user requirements, doesn't support the hierarchy well enough, doesn't allow me to control the format/export enough. 

I need more control on the URs, but want them linked easily to work items with a "no excuses" experience for the devs as they work on jira items.

The primary concern for this idea is to embed Confluence content inside a JIRA Description field. So, basically dumping the content from a linked Confluence page directly into the JIRA issue so that the user doesn't have to navigate into Confluence to get the information required.

We don't have anything out-of-the-box for embedding an entire Confluence page into an issue. There are remote issue links to see which Confluence pages link to a given JIRA ticket and a Confluence page gadget to embed an entire Confluence page into a JIRA dashboard.

As a product manager, I'd love to hear more about the kind of issues and pages you're creating, your workflow and how it requires you to embed Confluence into JIRA.

Hi all,

regarding "extracting statistics data" you shold check for jira "timetracking" extensions. For the rest, I would recommend using jira for tasks and developercommunication only.

confluence is the concept, spec, documentation and manual. Jira is for discussions between productowners, pm, developers and testers. Once a discussion is cleared, the corresponding wiki page(s) should be updated before closing the ticket.

You do not want documentation to be stored inside jira comments etc. and that will start if you start using jira as doc-source (by copying whole wikisections inside jira) - at least I do fear so much.

Josh

The intended use of our need would allow us to move all documentation into Confluence. Confluence pages would have all the documentation but issues in JIRA can reference parts or whole pages in Confluence, and that content is then displayed in a manor in JIRA so that the Developer can see the relevant section of confluence without having to click on another link to have to reference another web page. If we do documentation of Requirements in Confluence, we still need a place-holder for that requirement in JIRA so that issues can be linked to it and reported on accordingly. So, without a plugin like this, the developer will be assigned a task in JIRA, they will look at the linked requirement in JIRA, then have to click another link to go to the confluence page in order to get the information. So, the developer may need to have 3 web browser windows open while their IDE so that they can work on the issue. With the ability to inject the content into JIRA, the editable content stays in confluence, but it would eliminate 1-2 web pages that the developer would have to reference.

We are trying to get to the point of having all documentation in Confluence. Something that would be able to display the confluence data in JIRA would go a long way towards speeding up adoption. Let me know if you have any questions. Thanks.

Thats my point, Adam - leave the doc inside confluence - even to the point of not including wikipages inside jira-screens - to avoid "jira-ticket-comment-discussions" regarding the doc-content, maybe leading to part of the "doc-clarifications" or "doc-interpretations" not beeing transfered into the wiki, but left inside the jira-ticket-comments.

It should be enough to add a link inside the jira ticket, which references the wikipage in question

Josch - it's really not enough to just put the link in. We want to use Confluence to manage content and JIRA to manage workflow. The analysts spend most of their time in Confluence, and developers spend most of the time in JIRA. requiring developers to constantly click back and forth between confluence and JIRA is not a good workflow - its just enough of a barrier that they won't do it all the time, and they might easily get the issue numbers mixed up and push workflow on the wrong feature. Far better to just have the content right there in front of them.

Why not letting jira user use excerpt macro to reference Confluence content ? thus getting syncronized with eventual edits from confluence source specification...

Looking for the same thing.. we'd like to include confluence content in JIRA description (or even better: via a custom field). @ Bill -> This is to visualize a confluence-stored experience canvas on our Innovation Epics in JIRA.


Something similar used to exist before.. (see
Embedding-Confluence-Page-in-JIRA-Issue-detail-screen ) .. but not sure if the old plugin is still available somewhere.. or whether it cd be updated to support current versions.

We're having the same problem. We're using Confluence to manage Quarterly planning and building out our requirements per project. Each requirements document gets all the details and specs then we have to copy/paste into a Jira issue. If we adjust the requirements, we have to go back and manually reset the content in the Jira issue. Also, the almost-handy Jira Issues Macro is little better than cut and paste. It doesn't keep any of the formatting and really mangles what you've highlighted on its way over to Jira.

I want an iframe-like tool that will let me highlight a section of Confluence text and say: "Make this the Description in a new Jira issue(s) or in a specified Jira issue(s)." Then whenever I edit the Confluence content, I can check a box that says: "Update the matching Jira issue(s)."

Without this feature, Confluence and Jira working together is of limited use.

I do not know if it has been created before - searching for something similar did not show anything. So I created this issue: https://jira.atlassian.com/browse/JRA-38416. Please comment/elaborate on it :)

We also use Jira for documentation. In our particular case we use Confluence to document a technical process and then when its time to deploy it Jira is used for issue tracking.

I like both Jira and Confluence a great deal but it is quite annoying to not be able to put our relavent documentation in the description of a Jira ticket

What you could do is use JIRA to create your requirements as issues, then use the AJIIM macro (http://bit.ly/1kwt9uJ) to insert the JIRA issue in your Confluence page.

The difference with the JIRA Issue Macro is that AJIIM will automatically display the description of the JIRA issue in the Confluence page. So no need to jump from one tool to the other to see the content of the requirement. Basically, JIRA will be used to store the content of the Requirements and Confluence will let you use this content in your documents.

One little adjustment. It is better to position content in reference to right margin because left navigation pane in confluence is has flexible width.

 

 

{position:absolute;top:-374px;right:-400px;width:1300px;height:1500px;}

I know its mentioned above, as not the top[ic of this thread, but how do you show JIRA content in Confluence

 

The standard JIRA macro shows a link and the ticket summary on a confluence page but I'd like to show the description field too, so my clients can see and comment in Confluence, but not touch the dev ticket in JIRA.

In the Macro editor, select display options down at the bottom. Switch from Single issue to table and se3ect the fields you want to see in the "Columns to Display" section of the dialog.

If you don't see "Description" right click in the "Columns to Display" pane and choose it from the drop-down list

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

1,383 views 17 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you