Skip to main content

2 min read

How to create a Confluence page from a Jira post function

TW
champion hour sep
alert2 Icon
PLEASE NOTE
The content of this blog is no longer updated

During the November edition of our Champion Hour - ScriptRunner series, a ScriptRunner user asked us this question:

How do I create a Confluence page from a Jira workflow post function with many multiline text Jira fields which have HTML and XML tags in their content? 

copy_text Icon
Copied!

Below you will find guidance on how to achieve this, including the video demo and the Groovy code I used in the demo. Feel free to download it and use it for your own needs.

copy_text Icon
Copied!

The solution

To illustrate the example, I created a Jira issue which has a custom field “Ideas to Increase Sales” which contains HTML, and a custom field “Store Locations” which contains XML.

copy_text Icon
Copied!
improvements

I want to display HTML and data extracted from the XML in a Confluence page whenever the workflow transition to “Done” occurs. In order to achieve this, I’ll create a Custom Script Post Function on the “Done” workflow transition with the following script.

copy_text Icon
Copied!
code post junction

Please note that in this example I’m using app links, as this is the most universal way to achieve something like this. However, the more complex your use case is, you may want to consider using ScriptRunner’s remote control feature. Hope that helps!

Download the Groovy script file
copy_text Icon
Copied!
champion hour sep

Step by step guide

If you would like to watch a step-by step video demo of what I described above, check out this video.

Watch video

Try ScriptRunner for free for 30 days

ScriptRunner for Confluence is an amazingly versatile tool that lets you customise, extend and automate Confluence as much as you need. Explore what you can achieve with a 30-day free trial:

Start your free trial!
copy_text Icon
Copied!