Auto-create JIRA epic from when Confluence template loaded
Asked by Paul Travis:

We're trying to auto-create a "tracking" epic for a certain set of wiki pages we call "project cards" (for which we have a template) so we can follow them in a Kanban board.

Where is the best/easiest place to instantiate this code?


Answers:
author: Steven F Behnke
body: As I mentioned previously, this is not an option built-in. There is no automated functionality in JIRA to generate wiki pages in the Confluence product automatically here nor conversely to create JIRA issues upon Confluence wiki page creation. This is made a little more difficult by using Atlassian Cloud, an environment where we have less add-on functionality, because I usually just script it myself or investigate a custom add-on.  
**Potential option using Confluence**  
*Using Page Templates*

1. Using a Page Template, we can insert Instructional Text. This can specifically open the JIRA Macro when the user clicks it in Confluence.  
   ![](http://imgur.com/S5R5hda.png)  

2. Using the JIRA Macro, we can do a few operations  
   These will place the JIRA Macro on the page, as well as link the JIRA Issue to the Page and vice-versa --
   1. Search for an existing issue  
      ![](http://imgur.com/KmUffEi.png)  

   2. Look at my recently viewed existing issues  
      ![](http://imgur.com/kFP0WCg.png)  

   3. Create a new issue  
      ![](http://i.imgur.com/0cwptH2.png)

**Potential option using API available to Atlassian Cloud as well as self-hosted Atlassian Products**   
*Either using existing add-ons or a self-created, self-hosted, custom solution using existing API and functionality*

++Assumptions++

* JIRA has an available REST API as well as Webhooks
* Confluence has an available REST API as well as Webhooks

++Theoretical options++

* Custom
  * Develop a custom application/script/add-on that operates as a 'man-in-the-middle' to consume the Webhooks from JIRA or Confluence
  * This application/script/add-on can then perform RESTful operations to the appropriate application, in order to perform additional operations  
    * Self-hosted
    * Possibly packaged as an Atlassian Connect add-on
* Add-on
  * **Bob Swift CLI** may be able to help here  
    I am not familiar with his automation add-ons however I believe they work with Atlassian Cloud

**Potential option using add-ons available to self-hosted Atlassian Products** *Custom scripts run using a plethora of add-ons*

* **Script Runner** (paid now, free previously) allows you to write custom scripts
  * I have personally written groovy scripts that generate rich page content upon a transition within JIRA, attached to a transition as a "inline script post-function."


author: Paul Travis
body: Hello, anyone? :smile:

comments: author: Steven F Behnke
body: There's no built in way to accomplish this. Could you more plainly list out your use-case? We can probably accomplish this via an external application or custom script that could deal all the appropriate API handling.


author: Paul Travis
body: Right now we have:1. Our product managers create a project card from a confluence template.2. Then the instructions tell them to create a Jira epic for tracking, noting with a particular label, and copying the URL.3. They then paste the URL into (a) the confluence page header and (b) the associated tickets macro contained therein.I just can't figure out whether it's possible to hook code into the Confluence template to do this, or specifically into the "JIRA macro" area that shows up when I click in the "instructional text" area of the header -- thanks in advance for any ideas. Or, maybe you're teeing up to give me a quote which would be fine too.


author: Steven F Behnke
body: This helps with my answer, which I am pondering and will post in a little while. I'm not here to give service quotes, although one of the options in my Answer \*will\* be to seek the services of a professional company. Now, I publicly put my company, a consulting firm that works the Atlassian products and with users of Atlassian Tools, instead of always announcing that I do not work for Atlassian directly. But I don't usually push that agenda here. This is a friendly and helpful environment, and I would like to keep it that way. :)


Tags: cloud

confluence-cloud