For this exercise we need a Jira and a Confluence installed, up and running.

Now in Jira we need to install a free addon called “Easy Integrations for Jira”

Captura de pantalla 2020-01-19 a las 12.34.24

Once installed we need to configure it, we need to inform the URL of Confluence and a username and password to do the connection.

Captura de pantalla 2020-01-19 a las 12.36.51

Now open two windows, one for Jira and another for Confluence, we need data from the two systems to do the configuration.

In Jira edit a Workflow and in a selected transition add a new PostFunction. In this case the PostFunction called “Create Confluence Page“. At the same time in Confluence select a page to be considered as “template” and get the ID from the “Page Info” option.

We need to inform also the Page ID of the node/page to append the new pages inside

Captura de pantalla 2020-01-19 a las 12.41.34

In the below part we can set new Params in Groovy (of course), and this params can be collected and used in the new page in Confluence.

Remember the page title must be UNIQUE in Confluence!! in other words you need to append vars/params in the title like {{issue.key}} {{issue.updated}}

Captura de pantalla 2020-01-19 a las 12.45.07

Example of params:


assignee = $issue.assignee or {{issue.assignee}}
reporter = {{issue.reporter}}
date = $issue.created
formattedDate = $DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").format($issue.created)

issueid = $issue.key
issuetype = $issue.getIssueType().getName()
priority = $issue.getPriority().toString()
component= $issue.getComponents().toString()
labels = $issue.getLabels().toString()
status = $issue.getStatusObject().getName()
resolution= $issue.getResolution().toString()

brand = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_10705'))
website = $issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_21206'))
strategic =$issue.getCustomFieldValue($customFieldManager.getCustomFieldObject('customfield_28407'))

Now publish your Workflow, and to finish we need to set the content of the Confluence Page to get the params! It’s very easy just see this below picture

Captura de pantalla 2020-01-19 a las 12.48.57

And works perfect! New “automatic” page created on Transition!

Captura de pantalla 2020-01-19 a las 12.49.05

By MrAddon

 

Posted by:.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s