Possible to use Jira post function to create a confluence page

Would like to create a Confluence Page using post function in a Jira workflow. Is this possible?

The following features would also be desirable:

1. Page would be created using a specific Confluence Template
2. Page would be named the same as the Jira Issue
3. Page would be linked to Jira Issue

5 answers

1 accepted

Run CLI Actions in JIRA provides a post function for running Confluence (or other Atlassian product) actions like this with substitution variables like issue summary. Confluence CLI actions don't use templates, but you could copy from another page with find/replace type substitution. You could insert a link to the JIRA item in the page text.

How to create Confluence pages summarizes some of the techniques that can be used. This was created and improved after discussions with Cindy and others. Thanks for all the feedback.

Hi Bob

I have read your post and I have some questions for you.

1. How many plugins and their names are required to accomplish

a. Create the confluence page from Jira workflow

b. Automatically create link in Confluence page to Jira Issue

2. Do you have any examples of how this can be done

The CLI plugin linked above is all you need. Not your specific example, but there are some how tos linked from that page.

Hi Bob using the Jira CLI plugin I have so far been able to

1. Create a page in Confluence from a Workflow Transition (good!)

2. I have been able to name it using the %original_key% (good!)

But actually I would like to name the page with a combination of %original_key% and %issue_summary%

How do I accomplish this?

Just construct the title parameter with a combination of text and both substitution variables. Make sure you double quote the whole thing.

1. Page Name Issue Key & Summary (good!)

How to link newly created Confluence Page back to Jira Issue?

You would need to put the issue key somewhere in the page content. Likely, you would want to use the jira issues macro for that.

Ok to be more specific:

  • How do I get the macro on the page?
    • Should the Jira Issues Macro be on the page I am copying (the template)?
  • How do I get the Issue Key into that Macro?

When you do the create page, you provide page content in the content parameter. By default, it is wiki markup. So just get the correct wiki markup to have it create what you want.

Hi Bob:

addPage works for creating a new page with the proper content for Jira Reference

--action addPage --space "Demo" --title "%original_key%-%original_summary%" --content "{jira:%original_key%}" --server http://webapps.intra.cerveceradepr.com/confluence --user craig.hylwa --password xxx

But when using copyPage the page is created with proper title but no page content is not produced

--action copyPage --space ~craig.hylwa --title "Child" --newSpace "Demo" --newTitle "%original_key%-%original_summary%" --content "{jira:%original_key%}" --server http://webapps.intra.cerveceradepr.com/confluence --user craig.hylwa --password xxx

In the copyPage scenario what is required to produce the proper content?



copyPage copies the original content modified by findReplace or findReplaceRegex. So, you will need to figure out how to construct that to work.

Hi Bob:

  • On the page I am copying I have placed the following text Jira 123
  • I am attempting to use findReplace to find that text and replace it with the Jira Macro

--action addPage --space "Demo" --title "%original_key%-%original_summary%" --findReplace "jira123#{jira:%original_key%}" --special " #" --server http://webapps.intra.cerveceradepr.com/confluence --user craig.hylwa --password xxx

I am not getting any results on the page. What am I missing here?

Hi Bob:

Could really use some help on this one. If I can get this to work we will be purchasing the Jira CLI Plugin immediately.


Sorry Craig, just got back from Summit and will have a look soon. Let's take this to a support issue so it can be tracted properly - see CSOAP-222. Please watch that. It is really a Confluence CLI questions since it doesn't really matter if you are running it directly from the command line or through the CLI plugin.

OK now following there

0 votes
Daryl Chuah Atlassian Team Sep 02, 2013

Hi Craig

I believe this configuration is achievable by using a third-party plugin called Script Runner

You may refer the following discusssion for further guidelines and information:

Hopefully it helps :)

Hello Craig:

I am trying to do the exact same thing that you mention in your Oct 3rd @ 2:27 entry; --findReplace "jira123#{jira:%original_key%}"

I am automatically creating a Confluence page upon a JIRA issue transition (using copyPage) and I would like to automatically add a link to the newly created page on the JIRA issue. If you were successful in foing this, would you mind posting the action. Thank you.

Hi Cindy:

I was never able to do this but according to Bob Swift it is doable. Sorry, I can't be of more help.

No problem. I emailed Bob and he helped me set this up. It works great!

Can you share the solution?

Sure. Bob created an udated version of How to Create Confluence Pages. I followed the instructions in Scenario 4 - Link a Page back to JIRA.

I used, --findReplace LINK_TO_ISSUE:%original_key%

Then in the Confluence page that I was using as the template, I added the content below using the source editor. To do this I installed the Confluence Source Editor plugin which is free. Let me know if you have any more questions.

  <ac:macro ac:name="jira">

CLI action
Product: Confluence
Action: --action copyPage --space "ENH" --title "Epic Cover Page Template - Please Do Not Use" --newTitle "%original_key%: Cover Page - %original_summary%" --parent @home--findReplace LINK_TO_ISSUE:%original_key% --server http://....... --user "automatic" --password "automatic"

This is an old topic but I'm hoping someone can help me with a slightly extended issue:

I am using a similar setup as your's @Cindy Creswick to basically create a JIRA ticket that then has a post-function which creates a Confluence page from copyPage, then some way to notify the submitter that the confluence page has been created.  At it's most basic, I was hoping that the link would create a trackback between JIRA and Confluence, but this is not working for me (ie. no trackback is created, even though the link is successfully created) - is this the case for anyone else using this method?   The alternative I thought would be to use an @mention, but the macro requires an ID# which I don't have (just have the userid), or to add the user as a watcher, but I can't get the Data part to fire on the original page I created in the Action part.  Any thoughts?

Here's an example of my current  attempt:

CLI action
Product: Confluence
Action: --action copyPage --space SPC --title "questionnaire" --parent @home --newTitle "Doc: %issue_summary% %original_reporter%" --replace --findReplace "JIRALINK:%original_key%" --copyLabels --server "https://conf" --user x --password "y"
Data: --action addWatch --user "%original_reporter%" --space SPC --title "Doc: %issue_summary% %original_reporter%" --server "https://conf" --user x --password "y"

In this above, the action part works, but the data part never works, no matter what I put in.  I am probably doing something wrong, but syntactically it loks all correct to me.  Help?   My primary requirement is to be able to send a notification back to the person who created the JIRA ticket that triffered the creation of the counfluence page, which will be original_reporter.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

839 views 3 9
Read article

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