How to create Confluence page automatically with Jira issue content once Jira issue created in JIRA Service Management Cloud
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
There are departments that require the employee to create a Confluence page after raising a ticket to Jira to further track on detail information about their request. For example, when employees would like to request a work trip, they need to create a Jira ticket to Finance to approve budgeting, and on top of that, they need to fill up their trip itinerary. This article will guide you on how to automatically create a Confluence page using the "Work Trip Planner" template once the Jira ticket is created.
For a more general Confluence page template, may refer to Automating the creation of a Confluence page linked to a Jira ticket community post.
Environment
Jira Service Management Cloud
Solution
With this solution, the final result will be:-
- The employee will raise a ticket to propose a work trip with brief information.
- Automation will automatically create a page.
- The employee is expected to have a Confluence license to update the page with detailed information.
- Finance will review the ticket and transition the issue for approval from the Manager.
- The manager will review the Confluence page and approve it.
Let's do this:-
Step 1: Create a Jira Service Management project
- Go to the Jira site
- At the top bar, click Projects > Create Project
- Choose General service management for business teams project template
- Create the project, and you can name it Work Trip Planning
Step 2: Create a few custom fields for employees to fill up when creating the ticket.
- Go to Jira Settings > Issue > Custom fields
- Click Create Custom Fields
- Choose Date Picker custom field type
- Name it Travel Date and click Create
- In the search panel, key in the project key. Then, look for a screen with Jira Service Management: General Request Issue Screen name.
- Tick it and click Update
- Repeat the step 2 to 6 for the field below:-
- Trip Location - Use the "Short Text" custom field type
- Flight Date - Use the "Date Picker" custom field type
- Flight Time - Use the "Short Text" custom field type
Step 3: Create a new request type and update the form with the custom fields.
- Go to the new project you've created.
- Go to Project Settings > Request Types
- Click Create Request Type
- Key in Work Trip Proposal and choose to Submit a request or incident issue type
- Tick the General and click Create
- Open the newly created request type to edit the form.
- Drag all the new custom fields created previously from the right sidebar to the form. Including the "Approvers" field.
- Update the "Description" portal field name with "What is the purpose of this trip ?"
- The form setting will look as below:-
Step 4: Create the automation to automatically create a page once the ticket created
- The automation will look as below:-
- Download the attached file, and you may need to upload it to the site and update a few things based on the next steps.
- Go to the site's global automation page, which is https://xxxx.atlassian.net/jira/settings/automation
- Click the three dots on the top right corner and click Import Rule:-
- Click Upload JSON and choose the file
- Under "Restrict to projects" , choose the newly created project
- Tick it and click Next > Let's do this
- Go back to the project and go to Project Settings > Automation
- Open the newly uploaded automation.
- Click the Then : Send Web Request . The REST API used for this request are the Create Content API from Confluence Cloud , which is
POST /wiki/rest/api/content
- Update the section as per screenshot below :-
- For the Header section, add as below:-
- Header Name: Authorization
- Header Value: Basic XXXXX
- The XXXX value are a decoded Base64 value of username:API Token
- Follow the steps in Manage API tokens for your Atlassian account documentation to create an API Token for your Atlassian Account.
- Then, follow the instructions here to encode your useremail:APItoken to base64.
- Paste it to the Header Value
- For the space key, you can use the space created for the project.
- Go to Project Settings > Knowledge Base
- Hover to click the space name
- From the URL, you will notice the space key from "/wiki/spaces/XXX/overview" . The XXX are the space key
- Once done updating the automation, Save it and enable the automation.
JIRA Smart Value
In the custom data, there is a Jira Smart value already added. From the screenshot, you may notice the {{
smart value. For each value that you would like to carry over from Jira to the page, you must use the smart value. For a detailed explanation of the smart value, refer to this documentation: What are smart values?issue.summary}}
Step 5: Allowing the user with Confluence user to edit the page.
- Go to the space permission setting
- Add the groups that needed permission.
- Detail steps can, refer to Assign space permissions documentation.
Step 6: Configure the Approval configuration
- Go to Project Settings > Workflow
- Click the pencil icon for the Default ESM workflow for Jira Service Management workflow to edit it.
- In the Diagram view, click Pending status
- Tick the Include approval step and click Edit
- Update as per screenshot:-
- Additionally, if you would like to allow the employee to transition the issue to Pending status, you can click the transition and tick the Show transition in the customer portal.
- Once done, publish the workflow.
- For a detailed explanation about Approval and displaying transition in the workflow, may refer to the documentation.
Step 7: Allowing employee or customer to choose another account as an approver
- Go to Project Settings > Customer Permission
- Under "Customer Sharing", choose the Customers can search for other customers within their project or organizations.
- For detailed explanation about this, you may refer to this documentation: Change project customer permissions
Step 8: It's time to test
- Go to customer portal:-
- Choose Work Trip Proposal
- Raise a ticket as below:-
- A ticket will be created, and a comment will be added with the Confluence page link :-
- If the user has access to the space, he/she can access the link and edit it. The page will look as below:-
- From Jira, the ticket will look as below:-
- Assigned the ticket and transitioned it to "Pending". The approver will notice the Approve/Decline button as below:-
- The approval has been approved it and the comment will be updated with the approval status:-
- The ticket can be closed if needed.
In case you stumbled any issue configuring it , contact us the Atlassian Support