Possible to use Jira post function to create a confluence page

Craig Hylwa September 2, 2013

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

0 votes
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2013

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.

Craig Hylwa September 30, 2013

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

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 30, 2013
The CLI plugin linked above is all you need. Not your specific example, but there are some how tos linked from that page.
Craig Hylwa October 1, 2013

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?

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 1, 2013
Just construct the title parameter with a combination of text and both substitution variables. Make sure you double quote the whole thing.
Craig Hylwa October 1, 2013

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

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

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 1, 2013
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.
Craig Hylwa October 1, 2013

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?

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 2, 2013
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.
Craig Hylwa October 2, 2013

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?

Thanks-

Craig

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 2, 2013
copyPage copies the original content modified by findReplace or findReplaceRegex. So, you will need to figure out how to construct that to work.
Craig Hylwa October 2, 2013

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?

Craig Hylwa October 3, 2013

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.

Craig

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 4, 2013

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.

Craig Hylwa October 4, 2013

OK now following there

Sascha Ziemann May 26, 2020

I can not believe that there are still people suggesting to put passwords in command line arguments.

B I G   S E C U R I T Y   H O L E !

0 votes
B. Nana April 13, 2015

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.

0 votes
Cindy Creswick June 23, 2014

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.

<p>
  <ac:macro ac:name="jira">
    <ac:default-parameter>LINK_TO_ISSUE</ac:default-parameter>
  </ac:macro>
</p>


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"








0 votes
Cindy Creswick June 17, 2014

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.

Craig Hylwa June 22, 2014

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.

Cindy Creswick June 23, 2014

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

Craig Hylwa June 23, 2014

Can you share the solution?

0 votes
darylchuah
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 2, 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 :)

Suggest an answer

Log in or Sign up to answer