Confluence to Confluence and Confluence to JIRA linking questions

onkeldom
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.
December 3, 2012

Hi,

I'm going to bundle a few questions into one question, since they are all somehow connected.

1st: Confluence-JIRA linking
Is it possible to trigger the Create JIRA issue dialog via link or - even better - automatically after creating a new page in Confluence? Up until now I'm doing a manual bi-directional link using a (kind of dirty) user macro, which creates a new JIRA issue at click, gets the current page id, inserts the id as a label into the newly created issue and - with another macro - displays all issues using this exact label on the Confluence page owning the id. This is OK, if your creating multiple issues from one page but it's kind of ugly, if you only create one issue. The good looking JIRA-link (with summary, status, issuetype display) would be much nicer.

*Create JIRA issue code snippet*
{code}## @param ProjectID:type=string|required=true|desc=Die ID des Projekts, in welchem der Vorgang erstellt werden soll.
## @param LinkText:type=string|required=true
## @param IssueTypeID:type=string|required=true


#set($user=$action.getRemoteUser())
#set($baseurl=$req.getContextPath())

#set($link="https://jira.XXXXXX.eu/secure/CreateIssueDetails!init.jspa?pid=$paramProjectID&issuetype=$paramIssueTypeID&summary=$content.getTitle()&description=Die+genaue+Beschreibung+der+Story+ist+im+Wiki+zu+finden+unter+https://wiki.XXXXXX.eu/pages/viewpage.action?pageId=$content.getIdAsString()&labels=$content.getParent().getTitle().replace(' ', '_')&labels=$content.getIdAsString()&reporter=$user.name"){code}

*List JIRA issue code snippet*
{code}## @noparams

#set($macro1 = "{jiraissues:url=https://jira.XXXXXX.eu/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=labels%3D")

#set($label = $content.getIdAsString())

#set($macro2 = "&tempMax=1000|cache=off}")

#set($macroFinal = $macro1 + $label + $macro2)

$action.getHelper().renderConfluenceMacro($macroFinal){code}

2nd: Confluence-Confluence linking
I'm trying to "one-time" create a page - manually or, if possible, automatically - from another page using some parameters submitted via link. Sadly I'm only able to create and link a new, BLANK page or create - but not link - a new page with a given template. I'm further on not able to submit any labels to the new page ... at least all I've tried did not work.

*Using a template, but not linking the new page - Code snippet*
{code}
## @param SpaceKey:type=string|required=true
## @param DestinationParentID:type=string|required=true
## @param TemplateID:type=string|required=true

#set($baseurl = "$req.getContextPath()")
#set($newpagename=$content.getTitle())

<a href="$baseurl/pages/createpage-entervariables.action?spaceKey=$paramSpaceKey&fromPageId=$paramDestinationParentID&title=$newpagename&templateId=$paramTemplateID&linkCreation=true">HIER</a>
{code}

Any help here would really be appreciated.

6 answers

1 accepted

0 votes
Answer accepted
onkeldom
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.
December 11, 2012

Hi all,

thanks for your suggestions, i really appreciate your help. There have already been major confusions about how to use the current approach with all the linking between Confluence and JIRA, so we decided to drop it and just use JIRA as the main "input" system and linking Confluence pages manually from there on.

Thanks again and best regards,

Dom

1 vote
Alejandro Conde Carrillo
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.
December 12, 2012

2nd: Confluence-Confluence linking
I'm trying to "one-time" create a page - manually or, if possible, automatically - from another page using some parameters submitted via link. Sadly I'm only able to create and link a new, BLANK page or create - but not link - a new page with a given template. I'm further on not able to submit any labels to the new page ... at least all I've tried did not work.

This macro should do it:

## Macro title: Create page or show link
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: My Name
## Date created: dd/mm/yyyy
## Installed by: My Name

## This is an example macro
## @param page:page=Page Title|type=string|required=true|desc=Name of the page
## @param SpaceKey:spaceKey=Space Key|type=string|required=true|desc=Space Key
## @param DestinationParentID:DestinationParentID=Destination Parent ID|type=string|required=true|desc=Destination Parent ID
## @param TemplateID:TemplateID=Template ID|type=string|required=true|desc=ID of the template

#if ($parampage &amp;&amp; $parampage.length() &gt; 0)
  ## get page manager...
  #set($containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager'))
  #set($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null))
  #set($containerManager=$getInstanceMethod.invoke(null,null))
  #set($containerContext=$containerManager.containerContext)
  #set($pageManager=$containerContext.getComponent('pageManager'))
  ## find page...
  #if ($pageManager &amp;&amp; $pageManager.getPage($paramSpaceKey, $parampage).getTitle())
      ## The page exist, link to the page
      &lt;a href="$pageManager.getPage($paramspaceKey, $parampage).getUrlPath()"&gt;HIER&lt;/a&gt;
  #else
      ## The page does not exist, link to create from template
      &lt;a href="$action.getGlobalSettings().getBaseUrl()/pages/createpage-entervariables.action?spaceKey=$paramSpaceKey&amp;fromPageId=$paramDestinationParentID&amp;title=$parampage&amp;templateId=$paramTemplateID&amp;linkCreation=true"&gt;HIER&lt;/a&gt;
  #end
#end

0 votes
Jobin Kuruvilla [Adaptavist]
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.
December 4, 2012

Have a look at Issue Collector, which you can use from Confluence to create the issues. You can then probably have a filter that searches on the location or refferer. Never tried it, just an idea!

Jobin Kuruvilla [Adaptavist]
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.
December 4, 2012

The following JQL lets you search based on the confluence page link:

environment ~ "Page URL here"

onkeldom
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.
December 4, 2012

Hmmm ... never looked at the Issue Collector for this purpose. Maybe I should check it out...

0 votes
onkeldom
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.
December 4, 2012

Thank you both for the quick responses.

To clearify things a bit more. I'm looking for a way to exchange 2 user macros (Create new JIRA issue via link with a few supplied infos like issue summary, description, label /// List the one JIRA issue labeled with page id XYZ on the exact page which has the id XYZ) with already given features (create JIRA issue dialog box in Confluence and auto-backlinking in JIRA, if an issue is mentioned on a wiki page.

If I could trigger the dialog box via link or even automatically, I would not need to set the issue discription or a label (only needed for the bi-directional linking).

0 votes
Jobin Kuruvilla [Adaptavist]
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.
December 3, 2012

For Confluence-JIRA, your woraround seems good. Or try what Lucas suggested but that won't get you the id back as you are getting now!

For Confluence-confluence, have a look at link-page macro. That supports creating new pages with predefined template from a page and link it back.

http://wiki.customware.net/repository/display/AtlassianPlugins/link-page

0 votes
LucasA
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.
December 3, 2012

Hi Dominic,

JIRA doesn't have such a function. I've checked internally for some plugin for both JIRA and Confluence that could provide you this functionality, but I didn't found none.

However, a workaround would be sharing the Confluence page via email to a JIRA mail account with your snipet on the body. This way JIRA will parse and create the issue with the content that you have set.

Best regards,
Lucas Timm

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events