2 min read

How to create a Confluence page from a Jira post function

TW

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? 

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.

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.

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.

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

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!

Stay up to date by signing up for monthly Adaptanews